pub struct GameInstant { /* private fields */ }Expand description
Server-relative millisecond timestamp that wraps at 2^22 ms (~70 minutes).
Implementations§
Source§impl GameInstant
impl GameInstant
Sourcepub fn new(start_instant: &Instant) -> Self
pub fn new(start_instant: &Instant) -> Self
Creates a GameInstant representing the current time relative to start_instant.
Sourcepub fn time_since(&self, previous_instant: &GameInstant) -> GameDuration
pub fn time_since(&self, previous_instant: &GameInstant) -> GameDuration
Returns the duration elapsed since previous_instant (assumed to be in the past).
Sourcepub fn offset_from(&self, other: &GameInstant) -> i32
pub fn offset_from(&self, other: &GameInstant) -> i32
Signed millisecond offset to other (positive = other is later). Wraps correctly at 2^22.
Sourcepub fn is_more_than(&self, other: &GameInstant) -> bool
pub fn is_more_than(&self, other: &GameInstant) -> bool
Returns true if self is strictly later than other (wrapping-aware).
Returns true if self is strictly later than other (wrapping-aware).
Sourcepub fn add_millis(&self, millis: u32) -> Self
pub fn add_millis(&self, millis: u32) -> Self
Returns a new GameInstant millis milliseconds in the future (wrapping).
Sourcepub fn sub_millis(&self, millis: u32) -> Self
pub fn sub_millis(&self, millis: u32) -> Self
Returns a new GameInstant millis milliseconds in the past (wrapping).
Sourcepub fn add_signed_millis(&self, millis: i32) -> Self
pub fn add_signed_millis(&self, millis: i32) -> Self
Returns a new GameInstant offset by millis (positive = future, negative = past).
Trait Implementations§
Source§impl Clone for GameInstant
impl Clone for GameInstant
Source§fn clone(&self) -> GameInstant
fn clone(&self) -> GameInstant
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 moreSource§impl ConstBitLength for GameInstant
impl ConstBitLength for GameInstant
fn const_bit_length() -> u32
Source§impl Debug for GameInstant
impl Debug for GameInstant
Source§impl PartialEq for GameInstant
impl PartialEq for GameInstant
Source§fn eq(&self, other: &GameInstant) -> bool
fn eq(&self, other: &GameInstant) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serde for GameInstant
impl Serde for GameInstant
impl Copy for GameInstant
impl StructuralPartialEq for GameInstant
Auto Trait Implementations§
impl Freeze for GameInstant
impl RefUnwindSafe for GameInstant
impl Send for GameInstant
impl Sync for GameInstant
impl Unpin for GameInstant
impl UnsafeUnpin for GameInstant
impl UnwindSafe for GameInstant
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