Struct subtr_actor::actor_state::ActorStateModeler
source · pub struct ActorStateModeler {
pub actor_states: HashMap<ActorId, ActorState>,
pub actor_ids_by_type: HashMap<ObjectId, Vec<ActorId>>,
}
Expand description
A struct modeling the states of multiple actors at a given point in time. Provides methods to update that state with successive frames from a boxcars::Replay.
Fields§
§actor_states: HashMap<ActorId, ActorState>
A map of actor states with their corresponding actor ids.
actor_ids_by_type: HashMap<ObjectId, Vec<ActorId>>
A map of actor ids with their corresponding object ids.
Implementations§
source§impl ActorStateModeler
impl ActorStateModeler
sourcepub fn process_frame(
&mut self,
frame: &Frame,
frame_index: usize
) -> SubtrActorResult<()>
pub fn process_frame( &mut self, frame: &Frame, frame_index: usize ) -> SubtrActorResult<()>
Processes a frame, including handling of new, updated, and deleted actors.
Arguments
frame
- The frame to be processed.frame_index
- The index of the frame to be processed.
Returns
An empty result (Ok(())
) on success, SubtrActorError
on failure.
pub fn new_actor(&mut self, new_actor: &NewActor) -> SubtrActorResult<()>
pub fn update_attribute( &mut self, update: &UpdatedAttribute, frame_index: usize ) -> SubtrActorResult<Option<(Attribute, usize)>>
pub fn delete_actor( &mut self, actor_id: &ActorId ) -> SubtrActorResult<ActorState>
Auto Trait Implementations§
impl RefUnwindSafe for ActorStateModeler
impl Send for ActorStateModeler
impl Sync for ActorStateModeler
impl Unpin for ActorStateModeler
impl UnwindSafe for ActorStateModeler
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more