doc.rust-lang.org
pub fn elapsed(&self) -> Duration
Returns the amount of time elapsed since this instant.
method
std
Stable since 1.8.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn duration_since(&self, earlier: Instant) -> Duration
Returns the amount of time elapsed from another instant to this one, or zero duration if that instant is later than this one.
method
std
Stable since 1.8.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn checked_sub(&self, duration: Duration) -> Option<Instant>
Returns Some(t) where t is the time self - duration if t can be represented as Instant (which means it's inside the bounds of the underlying data structure), None otherwise.
method
std
Stable since 1.34.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn checked_duration_since(&self, earlier: Instant) -> Option<Duration>
Returns the amount of time elapsed from another instant to this one, or None if that instant is later than this one.
method
std
Stable since 1.39.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn checked_add(&self, duration: Duration) -> Option<Instant>
Returns Some(t) where t is the time self + duration if t can be represented as Instant (which means it's inside the bounds of the underlying data structure), None otherwise.
method
std
Stable since 1.34.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Instant
A measurement of a monotonically nondecreasing clock. Opaque and useful only with Duration.
struct
std
Stable since 1.8.0
Version 1.100.0-nightly
doc.rust-lang.org
pub mod time
Temporal quantification.
module
std
Stable since 1.3.0
Version 1.100.0-nightly
doc.rust-lang.org
pub macro thread_local!
Declare a new thread local storage key of type std::thread::LocalKey.
macro
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn unpark(&self)
Atomically makes the handle's token available if it is not already.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn name(&self) -> Option<&str>
Gets the thread's name.
method
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn id(&self) -> ThreadId
Gets the thread's unique identifier.
method
std
Stable since 1.19.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Thread
A handle to a thread.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn scope<'env, F, T>(f: F) -> T
Creates a scope for spawning scoped threads.
function
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn thread(&self) -> &Thread
Extracts a handle to the underlying thread.
method
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn join(self) -> Result<T>
Waits for the associated thread to finish.
method
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn is_finished(&self) -> bool
Checks if the associated thread has finished running its main function.
method
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct ScopedJoinHandle<'scope, T>
An owned permission to join on a scoped thread (block on its termination).
struct
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub fn spawn<F, T>(&'scope self, f: F) -> ScopedJoinHandle<'scope, T>
Spawns a new thread within a scope, returning a ScopedJoinHandle for it.
method
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct Scope<'scope, 'env>
A scope to spawn scoped threads in.
struct
std
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct LocalKey<T>
A thread local storage (TLS) key which owns its contents.
struct
std
Stable since 1.0.0
Version 1.100.0-nightly