Struct LocalFutureObj

pub struct LocalFutureObj<'a, T> { /* private fields */ }

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

impl<'a, T> LocalFutureObj<'a, T>

fn new<F: UnsafeFutureObj<'a, T> + 'a>(f: F) -> Self

Create a LocalFutureObj from a custom trait object representation.

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

impl<'a> From<Box<dyn Future<Output = ()> + 'a>> for LocalFutureObj<'a, ()>

fn from(boxed: Box<dyn Future<Output = ()> + 'a>) -> Self

impl<'a> From<Pin<Box<dyn Future<Output = ()> + 'a>>> for LocalFutureObj<'a, ()>

fn from(boxed: Pin<Box<dyn Future<Output = ()> + 'a>>) -> Self

impl<'a, F: Future<Output = ()> + 'a> From<Box<F>> for LocalFutureObj<'a, ()>

fn from(boxed: Box<F>) -> Self

impl<'a, F: Future<Output = ()> + 'a> From<Pin<Box<F>>> for LocalFutureObj<'a, ()>

fn from(boxed: Pin<Box<F>>) -> Self

impl<'a, T> From<FutureObj<'a, T>> for LocalFutureObj<'a, T>

fn from(f: FutureObj<'a, T>) -> Self

impl<T> Debug for LocalFutureObj<'_, T>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<T> Drop for LocalFutureObj<'_, T>

fn drop(&mut self)

impl<T> Future for LocalFutureObj<'_, T>

type Output = T;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<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>

impl<'a, T> Freeze for LocalFutureObj<'a, T> where *mut dyn Future<Output = T>: Freeze, unsafe fn(*mut dyn Future<Output = T>): Freeze,

impl<'a, T> UnsafeUnpin for LocalFutureObj<'a, T> where *mut dyn Future<Output = T>: UnsafeUnpin, unsafe fn(*mut dyn Future<Output = T>): UnsafeUnpin,

Blanket Implementations

impl<F> IntoFuture for LocalFutureObj<'a, T> where F: Future,

type Output = <F as Future>::Output;
type IntoFuture = F;
fn into_future(self) -> <F as IntoFuture>::IntoFuture

impl<T> Any for LocalFutureObj<'a, T> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for LocalFutureObj<'a, T> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for LocalFutureObj<'a, T> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for LocalFutureObj<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into<U> for LocalFutureObj<'a, T> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for LocalFutureObj<'a, T> where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for LocalFutureObj<'a, T> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>