pub struct Id(/* private fields */);Expand description
An opaque ID that uniquely identifies a runtime relative to all other currently running runtimes.
§Notes
- Runtime IDs are unique relative to other currently running runtimes. When a runtime completes, the same ID may be used for another runtime.
- Runtime IDs are not sequential, and do not indicate the order in which runtimes are started or any other data.
- The runtime ID of the currently running task can be obtained from the Handle.
§Examples
use tokio::runtime::Handle;
#[tokio::main(flavor = "multi_thread", worker_threads = 4)]
async fn main() {
println!("Current runtime id: {}", Handle::current().id());
}Trait Implementations§
impl Copy for Id
impl Eq for Id
impl StructuralPartialEq for Id
Auto Trait Implementations§
impl Freeze for Id
impl RefUnwindSafe for Id
impl Send for Id
impl Sync for Id
impl Unpin for Id
impl UnwindSafe for Id
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more