PollPersist

Enum PollPersist 

Source
pub enum PollPersist<T: Future> {
    Pending(Pin<Box<T>>),
    Ready(T::Output),
}
Expand description

A persistent future that can be polled multiple times.

When resolved, this future will update itself to store the resolved value. This allows it to be polled multiple times without cloning. Any resolution after the first will be completed immediately.

Variants§

§

Pending(Pin<Box<T>>)

The future has not been resolved yet.

§

Ready(T::Output)

The future has been resolved.

Implementations§

Source§

impl<T: Future> PollPersist<T>

Source

pub fn new(future: T) -> Self

Creates a new PollPersist from a future.

Source

pub async fn resolve(&mut self) -> &T::Output

Resolves the future.

Auto Trait Implementations§

§

impl<T> Freeze for PollPersist<T>
where <T as Future>::Output: Freeze,

§

impl<T> RefUnwindSafe for PollPersist<T>

§

impl<T> Send for PollPersist<T>
where <T as Future>::Output: Send, T: Send,

§

impl<T> Sync for PollPersist<T>
where <T as Future>::Output: Sync, T: Sync,

§

impl<T> Unpin for PollPersist<T>
where <T as Future>::Output: Unpin,

§

impl<T> UnwindSafe for PollPersist<T>
where <T as Future>::Output: UnwindSafe, T: UnwindSafe,

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.