Struct spin_sleep::SpinSleeper [−][src]
pub struct SpinSleeper { /* fields omitted */ }
Accuracy container for spin sleeping. See crate docs.
Methods
impl SpinSleeper
[src]
impl SpinSleeper
pub fn new(native_accuracy_ns: SubsecondNanoseconds) -> SpinSleeper
[src]
pub fn new(native_accuracy_ns: SubsecondNanoseconds) -> SpinSleeper
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]
pub fn native_accuracy_ns(self) -> SubsecondNanoseconds
Returns configured native_accuracy_ns
pub fn sleep(self, duration: Duration)
[src]
pub fn sleep(self, duration: Duration)
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]
pub fn sleep_s(self, seconds: Seconds)
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]
pub fn sleep_ns(self, nanoseconds: Nanoseconds)
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 Debug for SpinSleeper
[src]
impl Debug for SpinSleeper
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for SpinSleeper
[src]
impl Clone for SpinSleeper
fn clone(&self) -> SpinSleeper
[src]
fn clone(&self) -> SpinSleeper
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for SpinSleeper
[src]
impl Copy for SpinSleeper
impl PartialEq for SpinSleeper
[src]
impl PartialEq for SpinSleeper
fn eq(&self, other: &SpinSleeper) -> bool
[src]
fn eq(&self, other: &SpinSleeper) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &SpinSleeper) -> bool
[src]
fn ne(&self, other: &SpinSleeper) -> bool
This method tests for !=
.
impl Eq for SpinSleeper
[src]
impl Eq for SpinSleeper
impl Hash for SpinSleeper
[src]
impl Hash for SpinSleeper
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Default for SpinSleeper
[src]
impl Default for SpinSleeper
Auto Trait Implementations
impl Send for SpinSleeper
impl Send for SpinSleeper
impl Sync for SpinSleeper
impl Sync for SpinSleeper