Skip to main content

Predicate

Trait Predicate 

Source
pub trait Predicate: Sized + Clone {
    // Required method
    fn should(&mut self, ctx: &mut NpcCtx<'_, '_>) -> bool;

    // Provided methods
    fn chance(self, chance: f32) -> Chance<Self> { ... }
    fn time_hint(&self) -> Option<f32> { ... }
}

Required Methods§

Source

fn should(&mut self, ctx: &mut NpcCtx<'_, '_>) -> bool

Provided Methods§

Source

fn chance(self, chance: f32) -> Chance<Self>

Source

fn time_hint(&self) -> Option<f32>

Hint for when this will be true.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§