Struct ThreadId
struct ThreadId(_)
A unique identifier for a running thread.
A ThreadId is an opaque object that uniquely identifies each thread
created during the lifetime of a process. ThreadIds are guaranteed not to
be reused, even when a thread terminates. ThreadIds are under the control
of Rust's standard library and there may not be any relationship between
ThreadId and the underlying platform's notion of a thread identifier --
the two concepts cannot, therefore, be used interchangeably. A ThreadId
can be retrieved from the id method on a Thread.
Examples
use thread;
let other_thread = spawn;
let other_thread_id = other_thread.join.unwrap;
assert!;
Implementations
impl ThreadId
fn as_u64(self: &Self) -> NonZero<u64>This returns a numeric identifier for the thread identified by this
ThreadId.As noted in the documentation for the type itself, it is essentially an opaque ID, but is guaranteed to be unique for each thread. The returned value is entirely opaque -- only equality testing is stable. Note that it is not guaranteed which values new threads will return, and this may change across Rust versions.
impl Clone for ThreadId
fn clone(self: &Self) -> ThreadId
impl Copy for ThreadId
impl Debug for ThreadId
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for ThreadId
impl Freeze for ThreadId
impl Hash for ThreadId
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl PartialEq for ThreadId
fn eq(self: &Self, other: &ThreadId) -> bool
impl RefUnwindSafe for ThreadId
impl Send for ThreadId
impl StructuralPartialEq for ThreadId
impl Sync for ThreadId
impl Unpin for ThreadId
impl UnsafeUnpin for ThreadId
impl UnwindSafe for ThreadId
impl<T> Any for ThreadId
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ThreadId
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ThreadId
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for ThreadId
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for ThreadId
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ThreadId
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for ThreadId
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ThreadId
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ThreadId
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>