Struct governor::nanos::Nanos

source ·
pub struct Nanos(/* private fields */);
Expand description

A number of nanoseconds from a reference point.

Nanos can not represent durations >584 years, but hopefully that should not be a problem in real-world applications.

Implementations§

source§

impl Nanos

source

pub fn as_u64(self) -> u64

source§

impl Nanos

Nanos as used by Jitter and other std-only features.

source

pub const fn new(u: u64) -> Self

source§

impl Nanos

source

pub fn saturating_sub(self, rhs: Nanos) -> Nanos

Trait Implementations§

source§

impl Add<Duration> for Nanos

§

type Output = Nanos

The resulting type after applying the + operator.
source§

fn add(self, other: Duration) -> Self

Performs the + operation. Read more
source§

impl Add<Nanos> for Duration

§

type Output = Duration

The resulting type after applying the + operator.
source§

fn add(self, other: Nanos) -> Self

Performs the + operation. Read more
source§

impl Add<Nanos> for Instant

§

type Output = Instant

The resulting type after applying the + operator.
source§

fn add(self, other: Nanos) -> Instant

Performs the + operation. Read more
source§

impl Add<Nanos> for Jitter

§

type Output = Nanos

The resulting type after applying the + operator.
source§

fn add(self, rhs: Nanos) -> Nanos

Performs the + operation. Read more
source§

impl Add<Nanos> for QuantaInstant

§

type Output = QuantaInstant

The resulting type after applying the + operator.
source§

fn add(self, other: Nanos) -> QuantaInstant

Performs the + operation. Read more
source§

impl Add<Nanos> for SystemTime

§

type Output = SystemTime

The resulting type after applying the + operator.
source§

fn add(self, other: Nanos) -> SystemTime

Performs the + operation. Read more
source§

impl Add for Nanos

§

type Output = Nanos

The resulting type after applying the + operator.
source§

fn add(self, rhs: Nanos) -> Self::Output

Performs the + operation. Read more
source§

impl Clone for Nanos

source§

fn clone(&self) -> Nanos

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Nanos

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Default for Nanos

source§

fn default() -> Nanos

Returns the “default value” for a type. Read more
source§

impl Div for Nanos

§

type Output = u64

The resulting type after applying the / operator.
source§

fn div(self, rhs: Nanos) -> Self::Output

Performs the / operation. Read more
source§

impl From<Duration> for Nanos

source§

fn from(d: Duration) -> Self

Converts to this type from the input type.
source§

impl From<Nanos> for Duration

source§

fn from(n: Nanos) -> Self

Converts to this type from the input type.
source§

impl From<Nanos> for u64

source§

fn from(n: Nanos) -> Self

Converts to this type from the input type.
source§

impl From<u64> for Nanos

source§

fn from(u: u64) -> Self

Converts to this type from the input type.
source§

impl Mul<u64> for Nanos

§

type Output = Nanos

The resulting type after applying the * operator.
source§

fn mul(self, rhs: u64) -> Self::Output

Performs the * operation. Read more
source§

impl Ord for Nanos

source§

fn cmp(&self, other: &Nanos) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for Nanos

source§

fn eq(&self, other: &Nanos) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Nanos

source§

fn partial_cmp(&self, other: &Nanos) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Reference for Nanos

source§

fn duration_since(&self, earlier: Self) -> Nanos

Determines the time that separates two measurements of a clock. Implementations of this must perform a saturating subtraction - if the earlier timestamp should be later, duration_since must return the zero duration.
source§

fn saturating_sub(&self, duration: Nanos) -> Self

Returns a reference point that lies at most duration in the past from the current reference. If an underflow should occur, returns the current reference.
source§

impl SampleUniform for Nanos

§

type Sampler = UniformJitter

The UniformSampler implementation supporting type X.
source§

impl Copy for Nanos

source§

impl Eq for Nanos

source§

impl StructuralPartialEq for Nanos

Auto Trait Implementations§

§

impl RefUnwindSafe for Nanos

§

impl Send for Nanos

§

impl Sync for Nanos

§

impl Unpin for Nanos

§

impl UnwindSafe for Nanos

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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<Borrowed> SampleBorrow<Borrowed> for Borrowed
where Borrowed: SampleUniform,

source§

fn borrow(&self) -> &Borrowed

Immutably borrows from an owned value. See Borrow::borrow
source§

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

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V