Struct futures_util::future::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
sourceimpl<'a, T> LocalFutureObj<'a, T>
impl<'a, T> LocalFutureObj<'a, T>
sourcepub fn new<F>(f: F) -> LocalFutureObj<'a, T>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
where
F: 'a + UnsafeFutureObj<'a, T>,
pub fn new<F>(f: F) -> LocalFutureObj<'a, T>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
where
F: 'a + UnsafeFutureObj<'a, T>,
Create a LocalFutureObj
from a custom trait object representation.
sourcepub unsafe fn into_future_obj(self) -> FutureObj<'a, T>ⓘNotable traits for FutureObj<'_, T>impl<'_, T> Future for FutureObj<'_, T> type Output = T;
pub unsafe fn into_future_obj(self) -> FutureObj<'a, T>ⓘNotable traits for FutureObj<'_, T>impl<'_, T> Future for FutureObj<'_, T> type Output = 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
sourceimpl<'_, T> Debug for LocalFutureObj<'_, T>
impl<'_, T> Debug for LocalFutureObj<'_, T>
sourceimpl<'_, T> Drop for LocalFutureObj<'_, T>
impl<'_, T> Drop for LocalFutureObj<'_, T>
sourceimpl<'a, F> From<Box<F, Global>> for LocalFutureObj<'a, ()> where
F: 'a + Future<Output = ()>,
impl<'a, F> From<Box<F, Global>> for LocalFutureObj<'a, ()> where
F: 'a + Future<Output = ()>,
sourcepub fn from(boxed: Box<F, Global>) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
pub fn from(boxed: Box<F, Global>) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
sourceimpl<'a> From<Box<dyn Future<Output = ()> + 'a, Global>> for LocalFutureObj<'a, ()>
impl<'a> From<Box<dyn Future<Output = ()> + 'a, Global>> for LocalFutureObj<'a, ()>
sourcepub fn from(
boxed: Box<dyn Future<Output = ()> + 'a, Global>
) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
pub fn from(
boxed: Box<dyn Future<Output = ()> + 'a, Global>
) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
sourceimpl<'a, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T>
impl<'a, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T>
sourcepub fn from(f: FutureObj<'a, T>) -> LocalFutureObj<'a, T>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
pub fn from(f: FutureObj<'a, T>) -> LocalFutureObj<'a, T>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
sourceimpl<'a, F> From<Pin<Box<F, Global>>> for LocalFutureObj<'a, ()> where
F: 'a + Future<Output = ()>,
impl<'a, F> From<Pin<Box<F, Global>>> for LocalFutureObj<'a, ()> where
F: 'a + Future<Output = ()>,
sourcepub fn from(boxed: Pin<Box<F, Global>>) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
pub fn from(boxed: Pin<Box<F, Global>>) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
sourceimpl<'a> From<Pin<Box<dyn Future<Output = ()> + 'a, Global>>> for LocalFutureObj<'a, ()>
impl<'a> From<Pin<Box<dyn Future<Output = ()> + 'a, Global>>> for LocalFutureObj<'a, ()>
sourcepub fn from(
boxed: Pin<Box<dyn Future<Output = ()> + 'a, Global>>
) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
pub fn from(
boxed: Pin<Box<dyn Future<Output = ()> + 'a, Global>>
) -> LocalFutureObj<'a, ()>ⓘNotable traits for LocalFutureObj<'_, T>impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
sourceimpl<'_, 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<F> IntoFuture for F where
F: Future,
impl<F> IntoFuture for F where
F: Future,
type Output = <F as Future>::Output
type Output = <F as Future>::Output
into_future
)The output that the future will produce on completion.
type Future = F
type Future = F
into_future
)Which kind of future are we turning this into?
sourcepub fn into_future(self) -> <F as IntoFuture>::Future
pub fn into_future(self) -> <F as IntoFuture>::Future
into_future
)Creates a future from a value.