pub struct AsyncSleep { /* private fields */ }Expand description
Runtime-agnostic async sleep future returned by async_sleep.
Polling the future for the first time spawns a single thread that
parks for the requested duration and wakes the registered
Waker when the deadline elapses. Subsequent polls return
Poll::Pending until the waker is invoked, at which point the
next poll returns Poll::Ready(()).
Used by the resilience decorator macros (#[retry],
#[rate_limit], #[circuit_breaker]) when wrapped around an
async fn. The sleep yields to the runtime for the full
duration, never blocks the executor thread.
Implementations§
Trait Implementations§
Source§impl Future for AsyncSleep
Available on crate feature serde only.
impl Future for AsyncSleep
Available on crate feature
serde only.Auto Trait Implementations§
impl Freeze for AsyncSleep
impl RefUnwindSafe for AsyncSleep
impl Send for AsyncSleep
impl Sync for AsyncSleep
impl Unpin for AsyncSleep
impl UnsafeUnpin for AsyncSleep
impl UnwindSafe for AsyncSleep
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,
Source§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