Struct FutureObj

struct FutureObj<'a, T>(_)

A custom trait object for polling futures, roughly akin to Box<dyn Future<Output = T> + Send + '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.

You should generally not need to use this type outside of no_std or when implementing Spawn, consider using BoxFuture instead.

Implementations

impl<'a, T> FutureObj<'a, T>

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

Create a FutureObj from a custom trait object representation.

impl<'a> From for FutureObj<'a, ()>

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

impl<'a> From for FutureObj<'a, ()>

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

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

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

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

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

impl<'a, T> Freeze for FutureObj<'a, T>

impl<'a, T> RefUnwindSafe for FutureObj<'a, T>

impl<'a, T> Sync for FutureObj<'a, T>

impl<'a, T> UnsafeUnpin for FutureObj<'a, T>

impl<'a, T> UnwindSafe for FutureObj<'a, T>

impl<F> IntoFuture for FutureObj<'a, T>

fn into_future(self: Self) -> <F as IntoFuture>::IntoFuture

impl<T> Any for FutureObj<'a, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for FutureObj<'a, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for FutureObj<'a, T>

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

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

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

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

fn from(t: T) -> T

Returns the argument unchanged.

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

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<T>

impl<T> Send for FutureObj<'_, T>

impl<T> Unpin for FutureObj<'_, T>

impl<T, U> Into for FutureObj<'a, T>

fn into(self: 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 for FutureObj<'a, T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for FutureObj<'a, T>

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