Struct embedded_runtime::context::SleepFuture
source · pub struct SleepFuture { /* private fields */ }Expand description
A passive future that can be polled once before it becomes ready; useful to suspend the current context and up a timeslice to the runtime/other pending futures
§Behaviour
Polling this future yields immediately WITHOUT WAKING THE WAKER AGAIN, making room for other futures to execute. This is useful to e.g. suspend the execution of the current routine if it cannot make any progress and has no associated event sources.
§Important
Unlike SpinFuture, this future DOES NOT wake the waker again. If the runtime enters deep-sleep, you MUST
ensure there are other pending futures or event sources to wake it up again.
Implementations§
source§impl SleepFuture
impl SleepFuture
sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a new spin future
§Note
This future should usually not be constructed directly, use sleep_once instead.
Trait Implementations§
source§impl Debug for SleepFuture
impl Debug for SleepFuture
source§impl Default for SleepFuture
impl Default for SleepFuture
source§impl Future for SleepFuture
impl Future for SleepFuture
Auto Trait Implementations§
impl Freeze for SleepFuture
impl RefUnwindSafe for SleepFuture
impl Send for SleepFuture
impl Sync for SleepFuture
impl Unpin for SleepFuture
impl UnwindSafe for SleepFuture
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
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more