pub struct SpawnableFuture<'a, O>(/* private fields */);
Expand description
SpawnableFuture
is a boxed future that can be spawned without incurring any more allocations
i.e. it doesn’t end up with the double boxing that you end up with if you try and spawn Box<dyn Future>
. It can be used in place of BoxFuture
although it carries more overhead than
BoxFuture
, so it shouldn’t be used if it isn’t going to be spawned on a scope.
SpawnableFuture
implements Future
but the future will not be running as a separate task if
used this way. If polled and then later spawned, the spawned task will be polled again and any
waker recorded when polled prior to spawning will be impotent.
Implementations§
Trait Implementations§
Source§impl<O> Future for &mut SpawnableFuture<'_, O>
impl<O> Future for &mut SpawnableFuture<'_, O>
Source§impl<O> Spawnable for SpawnableFuture<'static, O>
impl<O> Spawnable for SpawnableFuture<'static, O>
impl<O> Unpin for SpawnableFuture<'_, O>
Auto Trait Implementations§
impl<'a, O> Freeze for SpawnableFuture<'a, O>
impl<'a, O> !RefUnwindSafe for SpawnableFuture<'a, O>
impl<'a, O> Send for SpawnableFuture<'a, O>where
O: Send,
impl<'a, O> Sync for SpawnableFuture<'a, O>where
O: Sync,
impl<'a, O> !UnwindSafe for SpawnableFuture<'a, O>
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