Skip to main content

Facility

Trait Facility 

Source
pub trait Facility<S: DomainSpace>:
    Any
    + Send
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn step(
        &mut self,
        poses: &mut Store<Pose<S>>,
        step: Step,
        owner: Owner,
    ) -> Result<(), DomainError>;
    fn snapshot(&self, owner: Owner) -> Box<dyn Any + Send>;
    fn check_restore(
        &self,
        from: &(dyn Any + Send),
        owner: Owner,
    ) -> Result<(), RestoreError>;
    fn restore(
        &mut self,
        from: &(dyn Any + Send),
        owner: Owner,
    ) -> Result<(), RestoreError>;

    // Provided methods
    fn bind(&mut self, _scene: SceneId, _owner: Owner) { ... }
    fn set_pose(
        &mut self,
        _entity: Entity,
        _pose: Pose<S>,
        _poses: &mut Store<Pose<S>>,
        _owner: Owner,
    ) -> Option<Result<(), DomainError>> { ... }
    fn move_to(
        &mut self,
        _entity: Entity,
        _point: S::Point,
        _poses: &mut Store<Pose<S>>,
        _owner: Owner,
    ) -> Option<Result<(), DomainError>> { ... }
    fn synchronize(&mut self, _poses: &mut Store<Pose<S>>, _owner: Owner) { ... }
    fn release(&mut self, _entity: Entity, _owner: Owner) { ... }
    fn apply(
        &mut self,
        _command: &ChartCommand,
        _poses: &mut Store<Pose<S>>,
        _owner: Owner,
    ) -> Option<Result<Outcome, Rejection>> { ... }
}
Expand description

Engine-owned work inside one domain: step runs in the simulation phase’s domain-step entry, release at dispatch before the stores forget the entity, and apply gets first offer of a chart command.

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn step( &mut self, poses: &mut Store<Pose<S>>, step: Step, owner: Owner, ) -> Result<(), DomainError>

Source

fn snapshot(&self, owner: Owner) -> Box<dyn Any + Send>

Source

fn check_restore( &self, from: &(dyn Any + Send), owner: Owner, ) -> Result<(), RestoreError>

Refuses whatever restore would refuse, changing nothing; the session calls it on every facility before the first one restores.

Source

fn restore( &mut self, from: &(dyn Any + Send), owner: Owner, ) -> Result<(), RestoreError>

Provided Methods§

Source

fn bind(&mut self, _scene: SceneId, _owner: Owner)

Source

fn set_pose( &mut self, _entity: Entity, _pose: Pose<S>, _poses: &mut Store<Pose<S>>, _owner: Owner, ) -> Option<Result<(), DomainError>>

Source

fn move_to( &mut self, _entity: Entity, _point: S::Point, _poses: &mut Store<Pose<S>>, _owner: Owner, ) -> Option<Result<(), DomainError>>

Source

fn synchronize(&mut self, _poses: &mut Store<Pose<S>>, _owner: Owner)

Source

fn release(&mut self, _entity: Entity, _owner: Owner)

Source

fn apply( &mut self, _command: &ChartCommand, _poses: &mut Store<Pose<S>>, _owner: Owner, ) -> Option<Result<Outcome, Rejection>>

Some claims the command with its outcome; None leaves it to the domain.

Implementors§

Source§

impl<S> Facility<S> for Physics<S>
where S: Homogeneous + PhysicsSpace + Copy, S::Vector: VectorOps + Default, S::AngVel: PartialEq, S::Point: Sub<Output = S::Vector>,