Struct futures_util::task::LocalFutureObj
source · pub struct LocalFutureObj<'a, T> { /* private fields */ }
Expand description
A custom trait object for polling futures, roughly akin to
Box<dyn Future<Output = T> + 'a>
.
This custom trait object was introduced as currently it is not possible to
take dyn Trait
by value and Box<dyn Trait>
is not available in no_std
contexts.
Implementations§
source§impl<'a, T> LocalFutureObj<'a, T>
impl<'a, T> LocalFutureObj<'a, T>
sourcepub fn new<F>(f: F) -> LocalFutureObj<'a, T> ⓘwhere
F: UnsafeFutureObj<'a, T> + 'a,
pub fn new<F>(f: F) -> LocalFutureObj<'a, T> ⓘwhere
F: UnsafeFutureObj<'a, T> + 'a,
Create a LocalFutureObj
from a custom trait object representation.
sourcepub unsafe fn into_future_obj(self) -> FutureObj<'a, T> ⓘ
pub unsafe fn into_future_obj(self) -> FutureObj<'a, T> ⓘ
Converts the LocalFutureObj
into a FutureObj
.
Safety
To make this operation safe one has to ensure that the UnsafeFutureObj
instance from which this LocalFutureObj
was created actually
implements Send
.
Trait Implementations§
source§impl<T> Debug for LocalFutureObj<'_, T>
impl<T> Debug for LocalFutureObj<'_, T>
source§impl<T> Drop for LocalFutureObj<'_, T>
impl<T> Drop for LocalFutureObj<'_, T>
source§impl<'a, F> From<Box<F, Global>> for LocalFutureObj<'a, ()>where
F: Future<Output = ()> + 'a,
impl<'a, F> From<Box<F, Global>> for LocalFutureObj<'a, ()>where
F: Future<Output = ()> + 'a,
source§impl<'a, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T>
impl<'a, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T>
source§impl<'a, F> From<Pin<Box<F, Global>>> for LocalFutureObj<'a, ()>where
F: Future<Output = ()> + 'a,
impl<'a, F> From<Pin<Box<F, Global>>> for LocalFutureObj<'a, ()>where
F: Future<Output = ()> + 'a,
source§impl<T> Future for LocalFutureObj<'_, T>
impl<T> Future for LocalFutureObj<'_, T>
impl<T> Unpin for LocalFutureObj<'_, T>
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for LocalFutureObj<'a, T>
impl<'a, T> !Send for LocalFutureObj<'a, T>
impl<'a, T> !Sync for LocalFutureObj<'a, T>
impl<'a, T> !UnwindSafe for LocalFutureObj<'a, T>
Blanket Implementations§
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