Struct futures_task::LocalFutureObj
source · pub struct LocalFutureObj<'a, T> {
future: *mut dyn Future<Output = T> + 'static,
drop_fn: unsafe fn(_: *mut dyn Future<Output = T> + 'static),
_marker: PhantomData<&'a ()>,
}
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.
Fields§
§future: *mut dyn Future<Output = T> + 'static
§drop_fn: unsafe fn(_: *mut dyn Future<Output = T> + 'static)
§_marker: PhantomData<&'a ()>
Implementations§
source§impl<'a, T> LocalFutureObj<'a, T>
impl<'a, T> LocalFutureObj<'a, T>
sourcepub fn new<F: UnsafeFutureObj<'a, T> + 'a>(f: F) -> Self
pub fn new<F: UnsafeFutureObj<'a, T> + 'a>(f: F) -> Self
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, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T>
impl<'a, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T>
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> Freeze for LocalFutureObj<'a, T>
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<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,
§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