Struct async_gen::AsyncGen

source ·
pub struct AsyncGen<Y, Fut> { /* private fields */ }
Expand description

Represent an asyncronus generator. It implementations AsyncGenerator trait.

This struct is created by gen(). See its documentation for more details.

Implementations§

source§

impl<Fut, Y, R> AsyncGen<Y, Fut>where Fut: Future<Output = (Yield<Y>, R)>,

source

pub async fn resume(self: &mut Pin<&mut Self>) -> GeneratorState<Y, R>

See AsyncGenerator::poll_resume for more details.

source§

impl<Fut, Y> AsyncGen<Y, Fut>where Fut: Future<Output = (Yield<Y>, ())>,

source

pub fn into_async_iter(self) -> AsyncIter<Self>

Creates an async iterator from this generator.

Trait Implementations§

source§

impl<Fut, Y, R> AsyncGenerator for AsyncGen<Y, Fut>where Fut: Future<Output = (Yield<Y>, R)>,

§

type Yield = Y

The type of value this generator yields. Read more
§

type Return = R

The type of value this generator returns. Read more
source§

fn poll_resume( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll<GeneratorState<Self::Yield, Self::Return>>

Resumes the execution of this generator. Read more
source§

impl<'__pin, Y, Fut> Unpin for AsyncGen<Y, Fut>where __Origin<'__pin, Y, Fut>: Unpin,

Auto Trait Implementations§

§

impl<Y, Fut> !RefUnwindSafe for AsyncGen<Y, Fut>

§

impl<Y, Fut> Send for AsyncGen<Y, Fut>where Fut: Send, Y: Send + Sync,

§

impl<Y, Fut> Sync for AsyncGen<Y, Fut>where Fut: Sync, Y: Send + Sync,

§

impl<Y, Fut> !UnwindSafe for AsyncGen<Y, Fut>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.