pub struct DynFuture<T: 'static> { /* private fields */ }Expand description
Represents an asyncronous computation.
This is different from std::future::Future in that it
is a fixed size struct with a boxed future inside.
Using this is advantageous over Box<dyn Future<Output = T>> due to less overhead.
Implementations§
Source§impl<T> DynFuture<T>
impl<T> DynFuture<T>
Sourcepub fn new(f: impl Future<Output = T> + Send + 'static) -> Pin<Self>
pub fn new(f: impl Future<Output = T> + Send + 'static) -> Pin<Self>
Creates a new DynFuture from a std::future::Future.
This method may but rarely calls the global allocator. Almost all allocations occur via a fast path using a bump allocator.
Trait Implementations§
impl<T> Send for DynFuture<T>
impl<T> Unpin for DynFuture<T>
Auto Trait Implementations§
impl<T> Freeze for DynFuture<T>
impl<T> !RefUnwindSafe for DynFuture<T>
impl<T> !Sync for DynFuture<T>
impl<T> !UnwindSafe for DynFuture<T>
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