pub struct Executor { /* private fields */ }
Expand description
Future executor that utilises tokio
threads.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn graceful(guard: ShutdownGuard) -> Self
pub fn graceful(guard: ShutdownGuard) -> Self
Create a new Executor
with the given shutdown guard,
This will spawn tasks that are awaited gracefully in case the shutdown guard is triggered.
Sourcepub fn spawn_task<F>(&self, future: F) -> JoinHandle<F::Output>
pub fn spawn_task<F>(&self, future: F) -> JoinHandle<F::Output>
Spawn a future on the current executor, this is spawned gracefully in case a shutdown guard has been registered.
Sourcepub fn guard(&self) -> Option<&ShutdownGuard>
pub fn guard(&self) -> Option<&ShutdownGuard>
Get a reference to the shutdown guard,
if and only if the executor was created with Self::graceful
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Executor
impl RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnwindSafe for Executor
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