Type Alias Ticks

Source
pub type Ticks<T> = Instant<T, TicksUnit>;
Expand description

A timestamp from system ticks. Has an arbitrary unit that can be measured with Ticks::per_second().

Aliased Type§

struct Ticks<T>(/* private fields */);

Implementations§

Source§

impl<T: Timeline> Ticks<T>

Source

pub const fn into_raw(self) -> i64

Return the number of ticks contained by this Ticks.

Source

pub const fn from_raw(raw: i64) -> Self

Return a strongly-typed Ticks from a raw number of system ticks.

Source

pub fn per_second() -> i64

Return the number of high-precision timer ticks in a second.

Wraps the zx_ticks_per_second syscall.

Source§

impl Instant<BootTimeline, TicksUnit>

Source

pub fn get() -> Self

Read the number of high-precision timer ticks on the boot timeline. These ticks may be processor cycles, high speed timer, profiling timer, etc. They advance while the system is suspended.

Source§

impl Instant<MonotonicTimeline, TicksUnit>

Source

pub fn get() -> Self

Read the number of high-precision timer ticks on the monotonic timeline. These ticks may be processor cycles, high speed timer, profiling timer, etc. They do not advance while the system is suspended.

Wraps the zx_ticks_get syscall.

Source§

impl<T: Timeline, U: TimeUnit> Instant<T, U>

Source

pub const ZERO: Instant<T, U>

Trait Implementations

Source§

impl<T: Timeline, U: TimeUnit> Add<Duration<T, U>> for Instant<T, U>

Source§

type Output = Instant<T, U>

The resulting type after applying the + operator.
Source§

fn add(self, dur: Duration<T, U>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T: Timeline, U: TimeUnit> AddAssign<Duration<T, U>> for Instant<T, U>

Source§

fn add_assign(&mut self, dur: Duration<T, U>)

Performs the += operation. Read more
Source§

impl<T: Clone, U: Clone> Clone for Instant<T, U>

Source§

fn clone(&self) -> Instant<T, U>

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<T, U> Debug for Instant<T, U>

Source§

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

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

impl<T: Default, U: Default> Default for Instant<T, U>

Source§

fn default() -> Instant<T, U>

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

impl<T, U> FromBytes for Instant<T, U>
where zx_time_t: FromBytes, PhantomData<(T, U)>: FromBytes,

§

fn read_from_bytes(source: &[u8]) -> Result<Self, SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the given source. Read more
§

fn read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the prefix of the given source. Read more
§

fn read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), SizeError<&[u8], Self>>
where Self: Sized,

Reads a copy of Self from the suffix of the given source. Read more
Source§

impl<T, U> FromZeros for Instant<T, U>
where zx_time_t: FromZeros, PhantomData<(T, U)>: FromZeros,

§

fn zero(&mut self)

Overwrites self with zeros. Read more
§

fn new_zeroed() -> Self
where Self: Sized,

Creates an instance of Self from zeroed bytes. Read more
Source§

impl<T: Hash, U: Hash> Hash for Instant<T, U>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, U> IntoBytes for Instant<T, U>
where zx_time_t: IntoBytes, PhantomData<(T, U)>: IntoBytes,

§

fn as_bytes(&self) -> &[u8]
where Self: Immutable,

Gets the bytes of this value. Read more
§

fn as_mut_bytes(&mut self) -> &mut [u8]
where Self: FromBytes,

Gets the bytes of this value mutably. Read more
§

fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to dst. Read more
§

fn write_to_prefix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the prefix of dst. Read more
§

fn write_to_suffix( &self, dst: &mut [u8], ) -> Result<(), SizeError<&Self, &mut [u8]>>
where Self: Immutable,

Writes a copy of self to the suffix of dst. Read more
Source§

impl<T: Ord, U: Ord> Ord for Instant<T, U>

Source§

fn cmp(&self, other: &Instant<T, U>) -> 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,

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

impl<T: PartialEq, U: PartialEq> PartialEq for Instant<T, U>

Source§

fn eq(&self, other: &Instant<T, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd, U: PartialOrd> PartialOrd for Instant<T, U>

Source§

fn partial_cmp(&self, other: &Instant<T, U>) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: Timeline, U: TimeUnit> Sub<Duration<T, U>> for Instant<T, U>

Source§

type Output = Instant<T, U>

The resulting type after applying the - operator.
Source§

fn sub(self, dur: Duration<T, U>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Timeline, U: TimeUnit> Sub for Instant<T, U>

Source§

type Output = Duration<T, U>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Instant<T, U>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T: Timeline, U: TimeUnit> SubAssign<Duration<T, U>> for Instant<T, U>

Source§

fn sub_assign(&mut self, dur: Duration<T, U>)

Performs the -= operation. Read more
Source§

impl<T, U> TryFromBytes for Instant<T, U>
where zx_time_t: TryFromBytes, PhantomData<(T, U)>: TryFromBytes,

§

fn try_read_from_bytes( source: &[u8], ) -> Result<Self, ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read the given source as a Self. Read more
§

fn try_read_from_prefix( source: &[u8], ) -> Result<(Self, &[u8]), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the prefix of the given source. Read more
§

fn try_read_from_suffix( source: &[u8], ) -> Result<(&[u8], Self), ConvertError<Infallible, SizeError<&[u8], Self>, ValidityError<&[u8], Self>>>
where Self: Sized,

Attempts to read a Self from the suffix of the given source. Read more
Source§

impl<T: Copy, U: Copy> Copy for Instant<T, U>

Source§

impl<T: Eq, U: Eq> Eq for Instant<T, U>

Source§

impl<T, U> Immutable for Instant<T, U>
where zx_time_t: Immutable, PhantomData<(T, U)>: Immutable,

Source§

impl<T, U> StructuralPartialEq for Instant<T, U>