pub struct ThreadId(_);
A unique identifier for a running thread.
A ThreadId
is an opaque object that has a unique value for each thread that creates one. ThreadId
s are not guaranteed to correspond to a thread's system-designated identifier. A ThreadId
can be retrieved from the id
method on a Thread
.
use std::thread; let other_thread = thread::spawn(|| { thread::current().id() }); let other_thread_id = other_thread.join().unwrap(); assert!(thread::current().id() != other_thread_id);
impl ThreadId
[src]
pub fn as_u64(&self) -> NonZeroU64
[src]
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
[src]
impl Copy for ThreadId
[src]
impl Debug for ThreadId
[src]
impl Eq for ThreadId
[src]
impl Hash for ThreadId
[src]
fn hash<__H:Â Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher,Â
[src]1.3.0
impl PartialEq<ThreadId> for ThreadId
[src]
impl StructuralEq for ThreadId
[src]
impl StructuralPartialEq for ThreadId
[src]
impl RefUnwindSafe for ThreadId
impl Send for ThreadId
impl Sync for ThreadId
impl Unpin for ThreadId
impl UnwindSafe for ThreadId
impl<T> Any for T where
    T: 'static + ?Sized,Â
[src]
impl<T> Borrow<T> for T where
    T: ?Sized,Â
[src]
fn borrow(&self) -> &TⓘNotable traits for &'_ mut F
impl<'_, F> Future for &'_ mut F where
    F: Unpin + Future + ?Sized,Â
type Output = <F as Future>::Output;
impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized,Â
type Item = <I as Iterator>::Item;
impl<R:Â Read + ?Sized, '_> Read for &'_ mut R
impl<W:Â Write + ?Sized, '_> Write for &'_ mut W
[src]
impl<T> BorrowMut<T> for T where
    T: ?Sized,Â
[src]
fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut F
impl<'_, F> Future for &'_ mut F where
    F: Unpin + Future + ?Sized,Â
type Output = <F as Future>::Output;
impl<'_, I> Iterator for &'_ mut I where
    I: Iterator + ?Sized,Â
type Item = <I as Iterator>::Item;
impl<R:Â Read + ?Sized, '_> Read for &'_ mut R
impl<W:Â Write + ?Sized, '_> Write for &'_ mut W
[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.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
    U: TryFrom<T>,Â
[src]
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/thread/struct.ThreadId.html