pub struct Id(/* 私有字段 */);展开描述
唯一标识一个运行时(相对于所有其他当前正在运行的运行时)的不透明 ID。
§注意
- 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.
§示例
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 实现§
源代码§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
源代码§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. 更多信息