Struct shadow_shim_helper_rs::emulated_time::EmulatedTime
source · #[repr(C)]pub struct EmulatedTime(/* private fields */);
Expand description
An instant in time (analagous to std::time::Instant) in the Shadow simulation.
Implementations§
source§impl EmulatedTime
impl EmulatedTime
sourcepub const SIMULATION_START: Self = _
pub const SIMULATION_START: Self = _
The start time of the simulation - 00:00:00 UTC on 1 January, 2000.
sourcepub const UNIX_EPOCH: Self = _
pub const UNIX_EPOCH: Self = _
The Unix epoch (00:00:00 UTC on 1 January 1970)
pub const MAX: Self = _
pub const MIN: Self = _
sourcepub const fn from_c_emutime(val: CEmulatedTime) -> Option<Self>
pub const fn from_c_emutime(val: CEmulatedTime) -> Option<Self>
Get the instance corresponding to val
SimulationTime units since the Unix Epoch.
sourcepub const fn to_c_emutime(val: Option<Self>) -> CEmulatedTime
pub const fn to_c_emutime(val: Option<Self>) -> CEmulatedTime
Convert to number of SimulationTime units since the Unix Epoch.
sourcepub fn from_abs_simtime(val: SimulationTime) -> Self
pub fn from_abs_simtime(val: SimulationTime) -> Self
Get the instant corresponding to val
time units since the simulation began.
sourcepub fn to_abs_simtime(self) -> SimulationTime
pub fn to_abs_simtime(self) -> SimulationTime
Convert to the SimulationTime since the simulation began.
sourcepub fn duration_since(&self, earlier: &EmulatedTime) -> SimulationTime
pub fn duration_since(&self, earlier: &EmulatedTime) -> SimulationTime
Returns the duration since earlier
, or panics if earlier
is after self
, or
if the difference can’t be represented as SimulationTime.
sourcepub fn checked_duration_since(
&self,
earlier: &EmulatedTime,
) -> Option<SimulationTime>
pub fn checked_duration_since( &self, earlier: &EmulatedTime, ) -> Option<SimulationTime>
Returns the duration since earlier
, or None
if earlier
is after self
.
sourcepub fn saturating_duration_since(
&self,
earlier: &EmulatedTime,
) -> SimulationTime
pub fn saturating_duration_since( &self, earlier: &EmulatedTime, ) -> SimulationTime
Returns the duration since earlier
, or 0 if earlier
is after self
.
pub fn checked_add(&self, duration: SimulationTime) -> Option<EmulatedTime>
pub fn checked_sub(&self, duration: SimulationTime) -> Option<EmulatedTime>
pub fn saturating_add(&self, duration: SimulationTime) -> EmulatedTime
pub fn saturating_sub(&self, duration: SimulationTime) -> EmulatedTime
Trait Implementations§
source§impl Add<SimulationTime> for EmulatedTime
impl Add<SimulationTime> for EmulatedTime
source§type Output = EmulatedTime
type Output = EmulatedTime
The resulting type after applying the
+
operator.source§fn add(self, other: SimulationTime) -> Self
fn add(self, other: SimulationTime) -> Self
Performs the
+
operation. Read moresource§impl AddAssign<SimulationTime> for EmulatedTime
impl AddAssign<SimulationTime> for EmulatedTime
source§fn add_assign(&mut self, rhs: SimulationTime)
fn add_assign(&mut self, rhs: SimulationTime)
Performs the
+=
operation. Read moresource§impl Clone for EmulatedTime
impl Clone for EmulatedTime
source§fn clone(&self) -> EmulatedTime
fn clone(&self) -> EmulatedTime
Returns a copy 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 moresource§impl Debug for EmulatedTime
impl Debug for EmulatedTime
source§impl Hash for EmulatedTime
impl Hash for EmulatedTime
source§impl Instant for EmulatedTime
impl Instant for EmulatedTime
type Duration = SimulationTime
source§fn duration_since(&self, earlier: Self) -> Self::Duration
fn duration_since(&self, earlier: Self) -> Self::Duration
source§fn saturating_duration_since(&self, earlier: Self) -> Self::Duration
fn saturating_duration_since(&self, earlier: Self) -> Self::Duration
source§fn checked_duration_since(&self, earlier: Self) -> Option<Self::Duration>
fn checked_duration_since(&self, earlier: Self) -> Option<Self::Duration>
source§fn checked_add(&self, duration: Self::Duration) -> Option<Self>
fn checked_add(&self, duration: Self::Duration) -> Option<Self>
source§fn checked_sub(&self, duration: Self::Duration) -> Option<Self>
fn checked_sub(&self, duration: Self::Duration) -> Option<Self>
source§impl Ord for EmulatedTime
impl Ord for EmulatedTime
source§fn cmp(&self, other: &EmulatedTime) -> Ordering
fn cmp(&self, other: &EmulatedTime) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for EmulatedTime
impl PartialEq for EmulatedTime
source§impl PartialOrd for EmulatedTime
impl PartialOrd for EmulatedTime
source§impl Sub<SimulationTime> for EmulatedTime
impl Sub<SimulationTime> for EmulatedTime
source§type Output = EmulatedTime
type Output = EmulatedTime
The resulting type after applying the
-
operator.source§fn sub(self, other: SimulationTime) -> Self
fn sub(self, other: SimulationTime) -> Self
Performs the
-
operation. Read moresource§impl Sub for EmulatedTime
impl Sub for EmulatedTime
source§type Output = SimulationTime
type Output = SimulationTime
The resulting type after applying the
-
operator.source§impl SubAssign<SimulationTime> for EmulatedTime
impl SubAssign<SimulationTime> for EmulatedTime
source§fn sub_assign(&mut self, rhs: SimulationTime)
fn sub_assign(&mut self, rhs: SimulationTime)
Performs the
-=
operation. Read moreimpl Copy for EmulatedTime
impl Eq for EmulatedTime
impl StructuralPartialEq for EmulatedTime
Auto Trait Implementations§
impl Freeze for EmulatedTime
impl RefUnwindSafe for EmulatedTime
impl Send for EmulatedTime
impl Sync for EmulatedTime
impl Unpin for EmulatedTime
impl UnwindSafe for EmulatedTime
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)