Struct futures_util::task::LocalFutureObj [−][src]
pub struct LocalFutureObj<'a, T> { /* fields omitted */ }
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
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>,
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>,
impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Create a LocalFutureObj
from a custom trait object representation.
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
pub 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;
impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
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;
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;
impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
pub 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;
impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
pub 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;
impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
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;
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;
impl<'_, T> Future for LocalFutureObj<'_, T> type Output = T;
Performs the conversion.
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
Mutably borrows from an owned value. Read more
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?
into_future
)Creates a future from a value.