pub struct ExecutorHandle { /* private fields */ }Expand description
Handle task spawning and timer
Implementations§
Source§impl ExecutorHandle
impl ExecutorHandle
Sourcepub fn wait(&self, delay: Duration) -> TimerFuture<'_> ⓘ
pub fn wait(&self, delay: Duration) -> TimerFuture<'_> ⓘ
Create Future waiting for given duration.
Sourcepub fn wait_deadline(&self, timestamp: u64) -> TimerFuture<'_> ⓘ
pub fn wait_deadline(&self, timestamp: u64) -> TimerFuture<'_> ⓘ
Create Future waiting for given timestamp
Sourcepub fn spawn<Fut>(&self, fut: Fut) -> Task<Fut::Output>
pub fn spawn<Fut>(&self, fut: Fut) -> Task<Fut::Output>
Spawn a new task, running on runtime thread
Because it can be called on outside of runtime thread, the Future and its output must be Send
Sourcepub fn spawn_local<Fut>(&self, fut: Fut) -> Task<Fut::Output>
pub fn spawn_local<Fut>(&self, fut: Fut) -> Task<Fut::Output>
Spawn and run new task, on runtime thread.
Unlike ExecutorHandle::spawn this method check if this method called on runtime’s thread and will panic if it didn’t.
Therefore the Future and its output does not need to be Send
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ExecutorHandle
impl !RefUnwindSafe for ExecutorHandle
impl Send for ExecutorHandle
impl Sync for ExecutorHandle
impl Unpin for ExecutorHandle
impl !UnwindSafe for ExecutorHandle
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