Skip to main content

BehaviorSystem

Struct BehaviorSystem 

Source
pub struct BehaviorSystem { /* private fields */ }
Expand description

Runs a world’s Behavior components: their firing rules, their bodies, and the effects those produce.

new evaluates every run on the calling thread and persists nothing; a host lends it a thread pool through with_scheduler and somewhere to keep state through with_store.

Implementations§

Source§

impl BehaviorSystem

Source

pub fn new() -> Self

A system that evaluates serially and persists nothing.

Source

pub fn with_store(self, store: Box<dyn BehaviorStore>) -> Self

Keep this world’s variables and once flags in store.

Source

pub fn with_scheduler(self, scheduler: Box<dyn EvalScheduler>) -> Self

Fan a tick’s evaluation out through scheduler once enough instances fire at once to pay for it.

Trait Implementations§

Source§

impl Debug for BehaviorSystem

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BehaviorSystem

Source§

fn default() -> BehaviorSystem

Returns the “default value” for a type. Read more
Source§

impl System for BehaviorSystem

Source§

fn init(&mut self, ctx: &mut PipelineContext<'_>)

Run once at World::start, before the first step.
Source§

fn step(&mut self, ctx: &mut PipelineContext<'_>) -> StepResult

Run once per tick.
Source§

fn access(&self) -> Access

The data step may touch, consulted once when the schedule is built (after init, so a data-dependent system can compute it from its compiled state). The default claims everything: an undeclared system is ordered against all others and never runs concurrently, which is always safe. Declaring narrower access is what admits a system to shared waves and to debug-build access validation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.