pub struct WorldSnapshot {
pub id: SnapshotId,
pub tick: u64,
pub timestamp_ms: u64,
pub entities: HashMap<NetEntityId, EntitySnapshot>,
}Expand description
A complete snapshot of the world at a given tick.
Fields§
§id: SnapshotId§tick: u64§timestamp_ms: u64§entities: HashMap<NetEntityId, EntitySnapshot>Implementations§
Source§impl WorldSnapshot
impl WorldSnapshot
pub fn new(id: SnapshotId, tick: u64, timestamp_ms: u64) -> Self
pub fn add_entity(&mut self, snapshot: EntitySnapshot)
pub fn remove_entity(&mut self, id: NetEntityId) -> Option<EntitySnapshot>
pub fn get_entity(&self, id: NetEntityId) -> Option<&EntitySnapshot>
pub fn entity_count(&self) -> usize
pub fn total_size(&self) -> usize
Sourcepub fn delta_from(&self, baseline: &WorldSnapshot) -> SnapshotDelta
pub fn delta_from(&self, baseline: &WorldSnapshot) -> SnapshotDelta
Compute a delta from a baseline snapshot.
Sourcepub fn apply_delta(&self, delta: &SnapshotDelta) -> WorldSnapshot
pub fn apply_delta(&self, delta: &SnapshotDelta) -> WorldSnapshot
Apply a delta to produce a new WorldSnapshot.
Sourcepub fn merge_from(&mut self, other: &WorldSnapshot)
pub fn merge_from(&mut self, other: &WorldSnapshot)
Merge another snapshot into this one (union of entities, preferring other on conflict).
Trait Implementations§
Source§impl Clone for WorldSnapshot
impl Clone for WorldSnapshot
Source§fn clone(&self) -> WorldSnapshot
fn clone(&self) -> WorldSnapshot
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for WorldSnapshot
impl RefUnwindSafe for WorldSnapshot
impl Send for WorldSnapshot
impl Sync for WorldSnapshot
impl Unpin for WorldSnapshot
impl UnsafeUnpin for WorldSnapshot
impl UnwindSafe for WorldSnapshot
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.