pub struct FakeInstant {
pub offset: Duration,
}Expand description
A fake implementation of Instant for use in testing.
Fields§
§offset: DurationA 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
Source§type Output = FakeInstant
type Output = FakeInstant
The resulting type after applying the
+ operator.Source§impl AtomicInstant<FakeInstant> for FakeAtomicInstant
impl AtomicInstant<FakeInstant> for FakeAtomicInstant
Source§fn new(instant: FakeInstant) -> FakeAtomicInstant
fn new(instant: FakeInstant) -> FakeAtomicInstant
Instantiates
Self from the given instant.Source§fn store_max(&self, instant: FakeInstant, _ordering: Ordering)
fn store_max(&self, instant: FakeInstant, _ordering: Ordering)
Store the maximum of the current value and the provided value.
Source§impl Clone for FakeInstant
impl Clone for FakeInstant
Source§fn clone(&self) -> FakeInstant
fn clone(&self) -> FakeInstant
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 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 checked_duration_since(&self, earlier: FakeInstant) -> Option<Duration>
fn checked_duration_since(&self, earlier: FakeInstant) -> Option<Duration>
Returns the amount of time elapsed from another instant to this one. Read more
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 saturating_add(&self, duration: Duration) -> Self
fn saturating_add(&self, duration: Duration) -> Self
Returns the instant at
self + duration saturating to the maximum
representable instant value.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§fn saturating_duration_since(&self, earlier: Self) -> Duration
fn saturating_duration_since(&self, earlier: Self) -> Duration
Returns the amount of time elapsed from another instant to this one,
saturating at zero.
Source§fn panicking_add(&self, duration: Duration) -> Self
fn panicking_add(&self, duration: Duration) -> Self
Unwraps the result from
checked_add. Read moreSource§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§impl PartialOrd for FakeInstant
impl PartialOrd for FakeInstant
Source§impl Sub<Duration> for FakeInstant
impl Sub<Duration> for FakeInstant
Source§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
Source§impl<O, BC> BuildableCoreContext<BC> for Owhere
O: Default,
impl<O, BC> BuildableCoreContext<BC> for Owhere
O: Default,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CCwhere
Meta: ReceivableFrameMeta<CC, BC>,
Source§impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CCwhere
Meta: SendableFrameMeta<CC, BC>,
Source§fn send_frame<S>(
&mut self,
bindings_ctx: &mut BC,
metadata: Meta,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
fn send_frame<S>( &mut self, bindings_ctx: &mut BC, metadata: Meta, frame: S, ) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
Send a frame. Read more
Source§impl<BC, S, Meta, DeviceId> SendableFrameMeta<FakeCoreCtx<S, Meta, DeviceId>, BC> for Meta
impl<BC, S, Meta, DeviceId> SendableFrameMeta<FakeCoreCtx<S, Meta, DeviceId>, BC> for Meta
Source§fn send_meta<SS>(
self,
core_ctx: &mut FakeCoreCtx<S, Meta, DeviceId>,
bindings_ctx: &mut BC,
frame: SS,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, SS>>
fn send_meta<SS>( self, core_ctx: &mut FakeCoreCtx<S, Meta, DeviceId>, bindings_ctx: &mut BC, frame: SS, ) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, SS>>
Sends this frame metadata to the provided contexts.
Source§impl<Meta, BC> SendableFrameMeta<FakeFrameCtx<Meta>, BC> for Meta
impl<Meta, BC> SendableFrameMeta<FakeFrameCtx<Meta>, BC> for Meta
Source§fn send_meta<S>(
self,
core_ctx: &mut FakeFrameCtx<Meta>,
_bindings_ctx: &mut BC,
frame: S,
) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
fn send_meta<S>( self, core_ctx: &mut FakeFrameCtx<Meta>, _bindings_ctx: &mut BC, frame: S, ) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
Sends this frame metadata to the provided contexts.
Source§impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
impl<Id, CC, BC> TimerHandler<BC, Id> for CCwhere
BC: TimerBindingsTypes,
Id: HandleableTimer<CC, BC>,
Source§fn handle_timer(
&mut self,
bindings_ctx: &mut BC,
dispatch: Id,
timer: <BC as TimerBindingsTypes>::UniqueTimerId,
)
fn handle_timer( &mut self, bindings_ctx: &mut BC, dispatch: Id, timer: <BC as TimerBindingsTypes>::UniqueTimerId, )
Handle a timer firing. Read more