pub struct SpawnDespawnReplicator { /* private fields */ }Expand description
Manages spawn/despawn replication across the network.
Implementations§
Source§impl SpawnDespawnReplicator
impl SpawnDespawnReplicator
pub fn new() -> Self
Sourcepub fn queue_spawn(&mut self, event: SpawnEvent)
pub fn queue_spawn(&mut self, event: SpawnEvent)
Queue an entity spawn for replication.
Sourcepub fn queue_despawn(&mut self, event: DespawnEvent)
pub fn queue_despawn(&mut self, event: DespawnEvent)
Queue an entity despawn for replication.
Sourcepub fn acknowledge_spawn(&mut self, entity_id: SyncEntityId, client_id: u32)
pub fn acknowledge_spawn(&mut self, entity_id: SyncEntityId, client_id: u32)
Acknowledge that a client has received a spawn event.
Sourcepub fn client_knows_entity(
&self,
entity_id: SyncEntityId,
client_id: u32,
) -> bool
pub fn client_knows_entity( &self, entity_id: SyncEntityId, client_id: u32, ) -> bool
Check if a client knows about an entity.
Sourcepub fn pending_spawns_for_client(&self, client_id: u32) -> Vec<&SpawnEvent>
pub fn pending_spawns_for_client(&self, client_id: u32) -> Vec<&SpawnEvent>
Get pending spawns for a specific client (entities it doesn’t know about yet).
Sourcepub fn drain_spawns(&mut self) -> Vec<SpawnEvent>
pub fn drain_spawns(&mut self) -> Vec<SpawnEvent>
Drain all pending spawns.
Sourcepub fn drain_despawns(&mut self) -> Vec<DespawnEvent>
pub fn drain_despawns(&mut self) -> Vec<DespawnEvent>
Drain all pending despawns.
pub fn spawned_count(&self) -> usize
pub fn pending_spawn_count(&self) -> usize
pub fn pending_despawn_count(&self) -> usize
pub fn clear(&mut self)
Sourcepub fn get_spawn_event(&self, entity_id: SyncEntityId) -> Option<&SpawnEvent>
pub fn get_spawn_event(&self, entity_id: SyncEntityId) -> Option<&SpawnEvent>
Get the spawn event for a specific entity.
Sourcepub fn remove_client(&mut self, client_id: u32)
pub fn remove_client(&mut self, client_id: u32)
Remove client tracking when they disconnect.
Auto Trait Implementations§
impl Freeze for SpawnDespawnReplicator
impl RefUnwindSafe for SpawnDespawnReplicator
impl Send for SpawnDespawnReplicator
impl Sync for SpawnDespawnReplicator
impl Unpin for SpawnDespawnReplicator
impl UnsafeUnpin for SpawnDespawnReplicator
impl UnwindSafe for SpawnDespawnReplicator
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.