Skip to main content

ViewHistory

Struct ViewHistory 

Source
pub struct ViewHistory { /* private fields */ }
Expand description

The entities sent to one subscriber over the last ticks, as its interpolator holds them. See the module docs.

Implementations§

Source§

impl ViewHistory

Source

pub fn new(keep_ticks: u64) -> Self

Keep enough to place entities at ticks down to keep_ticks before the newest frame.

Source

pub fn keep_ticks(&self) -> u64

How many ticks back position_at can see.

Source

pub fn last_tick(&self) -> Option<u64>

The newest tick recorded.

Source

pub fn clear(&mut self)

Forget everything (a new connection, or the subscriber’s baseline was reset).

Source

pub fn record( &mut self, tick: u64, precision: f32, full: bool, spawned: &[Sent], updated: &[Sent], despawned: &[EntityId], )

Record a frame sent for tick. full is a frame that lists every entity the subscriber has, as spawned. Positions are quantized; the subscriber places them at q * precision.

Source

pub fn position_at(&self, id: EntityId, render_tick: f64) -> Option<[f64; 3]>

Where the subscriber drew id at render_tick (fractional), or None when the subscriber did not draw it then (not spawned yet, despawned, or never sent).

Source

pub fn entities_near( &self, center: [f64; 3], radius: f64, render_tick: f64, ) -> Vec<(EntityId, [f64; 3])>

Every entity the subscriber drew at render_tick within radius of center (3D distance), with its position then, in id order.

Source

pub fn ids(&self) -> impl Iterator<Item = EntityId> + '_

Ids the history holds a life for (open or recently ended).

Trait Implementations§

Source§

impl Clone for ViewHistory

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ViewHistory

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.