pub struct FakeClock {
pub monotonic_micros: u64,
pub unix_seconds: u64,
pub wall_uncertain: bool,
/* private fields */
}Expand description
Test clock with two time domains and an energy sample that is never inferred.
Fields§
§monotonic_micros: u64Steady elapsed time. Never converted into unix seconds.
unix_seconds: u64Explicit wall seconds. Not derived from monotonic advances.
wall_uncertain: boolSet when monotonic advances without a matching wall update.
Implementations§
Source§impl FakeClock
impl FakeClock
Sourcepub fn advance_micros(&mut self, delta: u64)
pub fn advance_micros(&mut self, delta: u64)
Advance the monotonic domain only. Wall is not implied; energy is unchanged.
Sourcepub fn advance_unix_seconds(&mut self, delta: u64)
pub fn advance_unix_seconds(&mut self, delta: u64)
Advance wall time explicitly. Does not move monotonic or energy.
Sourcepub fn mark_wall_uncertain(&mut self)
pub fn mark_wall_uncertain(&mut self)
Marks wall-clock reads uncertain.
Sourcepub fn set_energy_measured(&mut self, milli_joules: u64)
pub fn set_energy_measured(&mut self, milli_joules: u64)
Feeds a measured energy reading (mJ).
Sourcepub fn set_energy_estimated(&mut self, milli_joules: u64)
pub fn set_energy_estimated(&mut self, milli_joules: u64)
Feeds an estimated energy reading (mJ).
Sourcepub fn set_energy_unknown(&mut self)
pub fn set_energy_unknown(&mut self)
Marks energy unknown.
Sourcepub const fn energy_quality(self) -> ObservationQuality
pub const fn energy_quality(self) -> ObservationQuality
FakeClock::energy_quality.
Sourcepub fn energy_milli_joules(self) -> Result<u64, QdnfError>
pub fn energy_milli_joules(self) -> Result<u64, QdnfError>
Unknown energy is incomplete, never treated as zero joules.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FakeClock
impl RefUnwindSafe for FakeClock
impl Send for FakeClock
impl Sync for FakeClock
impl Unpin for FakeClock
impl UnsafeUnpin for FakeClock
impl UnwindSafe for FakeClock
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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