Skip to main content

Since

Struct Since 

Source
pub struct Since { /* private fields */ }
Expand description

A moment to measure from, KEPT - what a Deadline cannot be, because it borrows the context it reads the clock through and so cannot outlive the call that made it.

For a wait that is not a loop: something started now and asked about later, from a different call. A radio’s sweep is the first - each channel is listened to for a dwell, and the serve loop asks the radio once per turn whether it is time to tune the next; and the same loop times how long it has gone without reading a joined radio, and how long a request took to serve.

On an uncalibrated machine every budget has passed and nothing has elapsed. There is no duration to compare with, and the alternative - nothing ever passes - turns a dwell into a hang; this way a sweep still runs, only too fast to hear everything. calibrated says which case this is.

Implementations§

Source§

impl Since

Source

pub fn now(ctx: &ServiceContext) -> Self

Now.

Source

pub fn passed(&self, ctx: &ServiceContext, budget: Budget) -> bool

Has budget passed since this moment?

Source

pub fn elapsed_us(&self, ctx: &ServiceContext) -> u64

Microseconds since this moment; 0 when uncalibrated, where it cannot be known.

Source

pub fn elapsed_ms(&self, ctx: &ServiceContext) -> u64

Milliseconds since this moment; 0 when uncalibrated, where it cannot be known.

Source

pub fn elapsed_ticks(&self, ctx: &ServiceContext) -> u64

Counter ticks since this moment - the unit a benchmark reports in. Counts even when the machine is uncalibrated, because the counter runs whether or not anyone knows its rate.

Trait Implementations§

Source§

impl Clone for Since

Source§

fn clone(&self) -> Since

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Since

Auto Trait Implementations§

§

impl Freeze for Since

§

impl RefUnwindSafe for Since

§

impl Send for Since

§

impl Sync for Since

§

impl Unpin for Since

§

impl UnsafeUnpin for Since

§

impl UnwindSafe for Since

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.