pub struct ActorStateModeler {
pub actor_states: HashMap<ActorId, ActorState>,
pub actor_ids_by_type: HashMap<ObjectId, Vec<ActorId>>,
pub recently_deleted_actor_states: HashMap<ActorId, ActorState>,
}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.
recently_deleted_actor_states: HashMap<ActorId, ActorState>Actor states deleted while processing the current frame.
This preserves last-known attributes long enough for code that runs after deletion, such as same-frame demolition extraction, to still inspect the removed actor.
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>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ActorStateModeler
impl RefUnwindSafe for ActorStateModeler
impl Send for ActorStateModeler
impl Sync for ActorStateModeler
impl Unpin for ActorStateModeler
impl UnsafeUnpin 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