pub struct Id(/* private fields */);展开描述
一个不透明的 ID,相对于所有其他当前 running runtimes.
§Notes
- Runtime ID 相对于其他当前正在运行的运行时是唯一的。当一个运行时结束后,同一 ID 可被另一个运行时复用。
- Runtime ID 不是连续的,也不表示运行时启动的顺序或任何其他数据。
- The runtime ID of the currently running task can be obtained from the Handle.
§示例
use tokio::runtime::Handle;
#[tokio::main(flavor = "multi_thread", worker_threads = 4)]
async fn main() {
println!("Current runtime id: {}", Handle::current().id());
}Trait 实现§
impl Copy for Id
impl Eq for Id
impl StructuralPartialEq for Id
自动 Trait 实现§
impl Freeze for Id
impl RefUnwindSafe for Id
impl Send for Id
impl Sync for Id
impl Unpin for Id
impl UnsafeUnpin for Id
impl UnwindSafe for Id
Blanket 实现§
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. 更多信息