[][src]Struct spin_sleep::SpinSleeper

pub struct SpinSleeper { /* fields omitted */ }

Accuracy container for spin sleeping. See crate docs.

Methods

impl SpinSleeper[src]

pub fn new(native_accuracy_ns: SubsecondNanoseconds) -> SpinSleeper[src]

Constructs new SpinSleeper with the input native sleep accuracy. The lower the native_accuracy_ns the more we effectively trust the accuracy of the thread::sleep function.

pub fn native_accuracy_ns(self) -> SubsecondNanoseconds[src]

Returns configured native_accuracy_ns

pub fn sleep(self, duration: Duration)[src]

Puts the current thread to sleep, if duration is long enough, then spins until the specified duration has elapsed.

Windows: Automatically selects the best native sleep accuracy generally achieving ~1ms native sleep accuracy, instead of default ~16ms.

pub fn sleep_s(self, seconds: Seconds)[src]

Puts the current thread to sleep, if duration is long enough, then spins until the specified second duration has elapsed.

Windows: Automatically selects the best native sleep accuracy generally achieving ~1ms native sleep accuracy, instead of default ~16ms.

pub fn sleep_ns(self, nanoseconds: Nanoseconds)[src]

Puts the current thread to sleep, if duration is long enough, then spins until the specified nanosecond duration has elapsed.

Windows: Automatically selects the best native sleep accuracy generally achieving ~1ms native sleep accuracy, instead of default ~16ms.

Trait Implementations

impl Clone for SpinSleeper[src]

impl Copy for SpinSleeper[src]

impl Debug for SpinSleeper[src]

impl Default for SpinSleeper[src]

fn default() -> Self[src]

Constructs new SpinSleeper with defaults suiting the current OS

impl Eq for SpinSleeper[src]

impl Hash for SpinSleeper[src]

impl PartialEq<SpinSleeper> for SpinSleeper[src]

impl StructuralEq for SpinSleeper[src]

impl StructuralPartialEq for SpinSleeper[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.