Skip to main content

Behavior

Trait Behavior 

Source
pub trait Behavior: Any + Debug {
    // Required methods
    fn score(&self, world: &World) -> Result<BehaviorScore>;
    fn behave(&self, world: &mut World) -> Result<ControlFlow<()>>;

    // Provided method
    fn boxed(self) -> Box<dyn Behavior>
       where Self: Sized + 'static { ... }
}

Required Methods§

Source

fn score(&self, world: &World) -> Result<BehaviorScore>

Source

fn behave(&self, world: &mut World) -> Result<ControlFlow<()>>

Provided Methods§

Source

fn boxed(self) -> Box<dyn Behavior>
where Self: Sized + 'static,

Implementors§