Struct nix::time::ClockId

pub struct ClockId(_);
Documentation

Clock identifier

Newtype pattern around clockid_t (which is just alias). It pervents bugs caused by accidentally passing wrong value.

Implementations

impl ClockId
pub const fn from_raw(clk_id: clockid_t) -> Self

Creates ClockId from raw clockid_t

pub fn pid_cpu_clock_id(pid: Pid) -> Result<Self>

Returns ClockId of a pid CPU-time clock

pub fn res(Self) -> Result<TimeSpec>

Returns resolution of the clock id

pub fn now(Self) -> Result<TimeSpec>

Returns the current time on the clock id

pub fn set_time(Self, timespec: TimeSpec) -> Result<()>

Sets time to timespec on the clock id

pub const fn as_raw(Self) -> clockid_t

Gets the raw clockid_t wrapped by self

const CLOCK_BOOTTIME: ClockId = _
const CLOCK_MONOTONIC: ClockId = _
const CLOCK_REALTIME: ClockId = _

Trait Implementations

impl Clone for ClockId
fn clone(&Self) -> ClockId
impl Copy for ClockId
impl Debug for ClockId
fn fmt(&Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl Display for ClockId
fn fmt(&Self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Eq for ClockId
impl From<ClockId> for clockid_t
fn from(clock_id: ClockId) -> Self
impl From<i32> for ClockId
fn from(clk_id: clockid_t) -> Self
impl Hash for ClockId
fn hash<__H: $crate::hash::Hasher>(&Self, state: &mut __H) -> ()
impl Ord for ClockId
fn cmp(&Self, other: &ClockId) -> $crate::cmp::Ordering
impl PartialEq<ClockId> for ClockId
fn eq(&Self, other: &ClockId) -> bool
fn ne(&Self, other: &ClockId) -> bool
impl StructuralEq for ClockId

Auto Trait Implementations

impl Send for ClockId
impl Sync for ClockId
impl Unpin for ClockId
impl UnwindSafe for ClockId

Blanket Implementations

impl<T> Any for T
where
    T: 'static + ?Sized,
fn type_id(&Self) -> TypeId
impl<T> Borrow<T> for T
where
    T: ?Sized,
fn borrow(&Self) -> &T
impl<T> BorrowMut<T> for T
where
    T: ?Sized,
fn borrow_mut(&mut Self) -> &mut T
impl<T> From<T> for T
fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for T
where
    U: From<T>,
fn into(Self) -> U

Calls U::from(self).

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

impl<T> ToOwned for T
where
    T: Clone,
type Owned = T
fn to_owned(&Self) -> T
fn clone_into(&Self, target: &mut T)
impl<T> ToString for T
where
    T: Display + ?Sized,
fn to_string(&Self) -> String
impl<T, U> TryFrom<U> for T
where
    U: Into<T>,
type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for T
where
    U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
fn try_into(Self) -> Result<U, <U as TryFrom<T>>::Error>