UnderlyingObjectFuture

Struct UnderlyingObjectFuture 

Source
pub struct UnderlyingObjectFuture<T, O> { /* private fields */ }
Expand description

It is used internally here, but left pub as maybe somebody could use it in other circumstances. Holds a pinned future of a function from an object and the object itself, guaranteeing by doing so the lifetime of the object and its func-future to co-exist. You need this if you want to poll a Future of a function from a object in an async manner. As we hold the object together with the future of its function in a tuple, the object lives at least as long as the future it returns.

Implementations§

Source§

impl<T, O> UnderlyingObjectFuture<T, O>

Source

pub fn new(object: T, getter: GetFutureFunc<T, O>) -> Self

Create new UnderlyingObjectFuture consuming the given object. getter can be easily implemented using the impl_getter macro and defines the function-future from the object-function.

Source

pub fn take(&mut self) -> &mut Pin<Box<dyn Future<Output = (O, T)>>>

Get the future from the object and encapsulate the future with the object or deliver the previous future if the object is already gone.

Source

pub fn reset(&mut self, left: T)

Reset to object

Auto Trait Implementations§

§

impl<T, O> Freeze for UnderlyingObjectFuture<T, O>
where T: Freeze,

§

impl<T, O> !RefUnwindSafe for UnderlyingObjectFuture<T, O>

§

impl<T, O> !Send for UnderlyingObjectFuture<T, O>

§

impl<T, O> !Sync for UnderlyingObjectFuture<T, O>

§

impl<T, O> Unpin for UnderlyingObjectFuture<T, O>
where T: Unpin,

§

impl<T, O> !UnwindSafe for UnderlyingObjectFuture<T, O>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.