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