pub struct Runtime { /* private fields */ }Expand description
A configured, not yet running, thread-per-core runtime.
Implementations§
Source§impl Runtime
impl Runtime
Sourcepub fn handle(&self) -> Handle
pub fn handle(&self) -> Handle
A handle that can be sent to other threads to talk to this runtime.
Sourcepub fn run<F, Fut>(self, f: F) -> Result<()>
pub fn run<F, Fut>(self, f: F) -> Result<()>
Starts one thread per worker and blocks until all of them finish.
f is called once on each worker thread (with the worker’s index) to
build that worker’s main future; a worker finishes when its main future
completes, at which point its remaining tasks are dropped (after the
grace period set with Builder::shutdown_grace, if any). Because each
future is created on the thread that runs it, it may be !Send.
A panic in a worker’s main future shuts the runtime down and is propagated to the caller.
Auto Trait Implementations§
impl Forget for Runtime
impl Freeze for Runtime
impl Move for Runtime
impl RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl UnwindSafe for Runtime
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