pub struct PredictedEntityMatcher<I> { /* private fields */ }Expand description
Bounded predicted-spawn registry for one client simulation.
Implementations§
Source§impl<I> PredictedEntityMatcher<I>
impl<I> PredictedEntityMatcher<I>
Sourcepub fn new(config: PredictedEntityConfig) -> NetcodeResult<Self>
pub fn new(config: PredictedEntityConfig) -> NetcodeResult<Self>
Creates an empty predicted-entity matcher.
Sourcepub fn register(
&mut self,
key: PredictionKey,
temporary_entity: I,
spawned_tick: u64,
) -> NetcodeResult<()>
pub fn register( &mut self, key: PredictionKey, temporary_entity: I, spawned_tick: u64, ) -> NetcodeResult<()>
Registers one temporary entity under a unique prediction key.
Sourcepub fn resolve(
&mut self,
key: PredictionKey,
authoritative_entity: I,
current_tick: u64,
) -> NetcodeResult<Option<EntityMatch<I>>>
pub fn resolve( &mut self, key: PredictionKey, authoritative_entity: I, current_tick: u64, ) -> NetcodeResult<Option<EntityMatch<I>>>
Resolves one authoritative spawn and removes its temporary mapping.
Sourcepub fn expire(&mut self, current_tick: u64) -> Vec<PredictedEntity<I>>
pub fn expire(&mut self, current_tick: u64) -> Vec<PredictedEntity<I>>
Removes and returns predictions older than the configured timeout.
Sourcepub fn get(&self, key: PredictionKey) -> Option<&PredictedEntity<I>>
pub fn get(&self, key: PredictionKey) -> Option<&PredictedEntity<I>>
Returns a pending prediction by key.
Trait Implementations§
Source§impl<I: Clone> Clone for PredictedEntityMatcher<I>
impl<I: Clone> Clone for PredictedEntityMatcher<I>
Source§fn clone(&self) -> PredictedEntityMatcher<I>
fn clone(&self) -> PredictedEntityMatcher<I>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<I> Freeze for PredictedEntityMatcher<I>
impl<I> RefUnwindSafe for PredictedEntityMatcher<I>where
I: RefUnwindSafe,
impl<I> Send for PredictedEntityMatcher<I>where
I: Send,
impl<I> Sync for PredictedEntityMatcher<I>where
I: Sync,
impl<I> Unpin for PredictedEntityMatcher<I>
impl<I> UnsafeUnpin for PredictedEntityMatcher<I>
impl<I> UnwindSafe for PredictedEntityMatcher<I>where
I: RefUnwindSafe,
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