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§
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>
Sourcefn check_restore(
&self,
from: &(dyn Any + Send),
owner: Owner,
) -> Result<(), RestoreError>
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.