Struct netstack3_core::testutil::context::FakeInstant
source · pub struct FakeInstant {
pub offset: Duration,
}
Expand description
A fake implementation of Instant
for use in testing.
Fields§
§offset: Duration
A FakeInstant is just an offset from some arbitrary epoch.
Implementations§
source§impl FakeInstant
impl FakeInstant
sourcepub const LATEST: FakeInstant = _
pub const LATEST: FakeInstant = _
The maximum value represented by a fake instant.
sourcepub fn saturating_add(self, dur: Duration) -> FakeInstant
pub fn saturating_add(self, dur: Duration) -> FakeInstant
Adds to this fake instant, saturating at [LATEST
].
Trait Implementations§
source§impl Add<Duration> for FakeInstant
impl Add<Duration> for FakeInstant
§type Output = FakeInstant
type Output = FakeInstant
The resulting type after applying the
+
operator.source§impl Clone for FakeInstant
impl Clone for FakeInstant
source§fn clone(&self) -> FakeInstant
fn clone(&self) -> FakeInstant
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 FakeInstant
impl Debug for FakeInstant
source§impl Default for FakeInstant
impl Default for FakeInstant
source§fn default() -> FakeInstant
fn default() -> FakeInstant
Returns the “default value” for a type. Read more
source§impl From<Duration> for FakeInstant
impl From<Duration> for FakeInstant
source§fn from(offset: Duration) -> FakeInstant
fn from(offset: Duration) -> FakeInstant
Converts to this type from the input type.
source§impl Hash for FakeInstant
impl Hash for FakeInstant
source§impl InspectableValue for FakeInstant
impl InspectableValue for FakeInstant
source§impl Instant for FakeInstant
impl Instant for FakeInstant
source§fn duration_since(&self, earlier: FakeInstant) -> Duration
fn duration_since(&self, earlier: FakeInstant) -> Duration
Returns the amount of time elapsed from another instant to this one. Read more
source§fn saturating_duration_since(&self, earlier: FakeInstant) -> Duration
fn saturating_duration_since(&self, earlier: FakeInstant) -> Duration
Returns the amount of time elapsed from another instant to this one,
saturating at zero.
source§fn checked_add(&self, duration: Duration) -> Option<FakeInstant>
fn checked_add(&self, duration: Duration) -> Option<FakeInstant>
Returns
Some(t)
where t
is the time self + duration
if t
can be
represented as Instant
(which means it’s inside the bounds of the
underlying data structure), None
otherwise.source§fn checked_sub(&self, duration: Duration) -> Option<FakeInstant>
fn checked_sub(&self, duration: Duration) -> Option<FakeInstant>
Returns
Some(t)
where t
is the time self - duration
if t
can be
represented as Instant
(which means it’s inside the bounds of the
underlying data structure), None
otherwise.source§impl Ord for FakeInstant
impl Ord for FakeInstant
source§fn cmp(&self, other: &FakeInstant) -> Ordering
fn cmp(&self, other: &FakeInstant) -> 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 FakeInstant
impl PartialEq for FakeInstant
source§fn eq(&self, other: &FakeInstant) -> bool
fn eq(&self, other: &FakeInstant) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for FakeInstant
impl PartialOrd for FakeInstant
source§fn partial_cmp(&self, other: &FakeInstant) -> Option<Ordering>
fn partial_cmp(&self, other: &FakeInstant) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Sub<Duration> for FakeInstant
impl Sub<Duration> for FakeInstant
§type Output = FakeInstant
type Output = FakeInstant
The resulting type after applying the
-
operator.source§impl Sub for FakeInstant
impl Sub for FakeInstant
impl Copy for FakeInstant
impl Eq for FakeInstant
impl StructuralPartialEq for FakeInstant
Auto Trait Implementations§
impl Freeze for FakeInstant
impl RefUnwindSafe for FakeInstant
impl Send for FakeInstant
impl Sync for FakeInstant
impl Unpin for FakeInstant
impl UnwindSafe for FakeInstant
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