pub struct Handle { /* private fields */ }Expand description
A thread-safe handle used to schedule work on a runtime.
Implementations§
Source§impl Handle
impl Handle
Sourcepub fn current() -> Handle
pub fn current() -> Handle
Returns a handle to the runtime active on the current thread.
§Panics
Panics if no runtime is active on the current thread.
Sourcepub fn spawn<F: Future + Send + 'static>(
&self,
future: F,
) -> JoinHandle<F::Output> ⓘ
pub fn spawn<F: Future + Send + 'static>( &self, future: F, ) -> JoinHandle<F::Output> ⓘ
Spawns a new asynchronous task, returning a JoinHandle for it.
Spawning a task enables the task to execute concurrently to other tasks. There is no guarantee that a spawned task will execute to completion.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Handle
impl !UnwindSafe for Handle
impl Freeze for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl UnsafeUnpin for Handle
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