Trait Act

Source
pub trait Act: Clone + Debug {
    // Provided method
    fn len(&self) -> usize { ... }
}
Expand description

A trait representing actions that can be taken in an environment.

This trait defines the interface for actions in reinforcement learning. Actions represent the decisions made by the agent that affect the environment.

§Requirements

Implementations must:

  • Be cloneable for efficient copying
  • Support debug formatting for logging and debugging

§Examples

#[derive(Clone, Debug)]
struct DiscreteAction {
    action: usize,
    num_actions: usize,
}

impl Act for DiscreteAction {
    fn len(&self) -> usize {
        self.num_actions
    }
}

Provided Methods§

Source

fn len(&self) -> usize

Returns the number of actions in the object.

§Note

This method is currently unimplemented and may be removed in future versions as it is not used in the current implementation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§