pub struct QueuedRuntime { /* private fields */ }
Expand description
A very small async runtime, with support for adding more tasks as it runs. This uses a VecDeque internally.
Implementations§
Source§impl QueuedRuntime
impl QueuedRuntime
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty QueuedRuntime. Awaiting this does nothing unless futures are pushed to it.
Examples found in repository?
More examples
Sourcepub fn new_with_boxed(future: BoxFuture<'static, ()>) -> Self
pub fn new_with_boxed(future: BoxFuture<'static, ()>) -> Self
Creates a new QueuedRuntime. Unlike new(), this adds a single future immediately, so awaiting this will have an effect.
Trait Implementations§
Source§impl Default for QueuedRuntime
impl Default for QueuedRuntime
Source§impl Future for QueuedRuntime
impl Future for QueuedRuntime
Source§impl InternalRuntime for QueuedRuntime
impl InternalRuntime for QueuedRuntime
Auto Trait Implementations§
impl !Freeze for QueuedRuntime
impl !RefUnwindSafe for QueuedRuntime
impl !Send for QueuedRuntime
impl !Sync for QueuedRuntime
impl Unpin for QueuedRuntime
impl !UnwindSafe for QueuedRuntime
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
Source§impl<'a, T> Runtime<'a> for Twhere
T: InternalRuntime,
impl<'a, T> Runtime<'a> for Twhere
T: InternalRuntime,
Source§fn push_boxed(&mut self, future: Pin<Box<dyn Future<Output = ()>>>)
fn push_boxed(&mut self, future: Pin<Box<dyn Future<Output = ()>>>)
Adds a new future to the queue to be completed.
Source§fn spawn_boxed(
&'a mut self,
future: Pin<Box<dyn Future<Output = ()>>>,
) -> SpawnedFuture<'a> ⓘ
fn spawn_boxed( &'a mut self, future: Pin<Box<dyn Future<Output = ()>>>, ) -> SpawnedFuture<'a> ⓘ
Adds a new future to the queue to be completed and returns a future waiting for the added
future’s completion.
Source§fn sleep<'b>(
&'a self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + 'b>>
fn sleep<'b>( &'a self, duration: Duration, ) -> Pin<Box<dyn Future<Output = ()> + 'b>>
Asynchronously sleeps
Source§fn push(&mut self, future: impl Future<Output = ()> + 'static)
fn push(&mut self, future: impl Future<Output = ()> + 'static)
Adds a new future to the queue to be completed.