[][src]Struct genawaiter::rc::Gen

pub struct Gen<Y, F: Future> { /* fields omitted */ }

This is a generator which stores its state on the heap.

See the module-level docs for more details.

Methods

impl<Y, F: Future> Gen<Y, F>[src]

pub fn new(start: impl FnOnce(Co<Y>) -> F) -> Self[src]

Creates a new generator from a function.

The function accepts a Co object, and returns a future. Every time the generator is resumed, the future is polled. Each time the future is polled, it should do one of two things:

  • Call Co::yield_(), and then return Poll::Pending.
  • Drop the Co, and then return Poll::Ready.

Typically this exchange will happen in the context of an async fn.

See the module-level docs for more details.

pub fn resume(&mut self) -> GeneratorState<Y, F::Output>[src]

Resumes execution of the generator.

If the generator yields a value, Yielded is returned. Otherwise, Completed is returned.

Trait Implementations

impl<Y, F: Future> Generator for Gen<Y, F>[src]

type Yield = Y

The type of value this generator yields.

type Return = F::Output

The type of value this generator returns.

impl<Y, F: Future<Output = ()>> IntoIterator for Gen<Y, F>[src]

type Item = Y

The type of the elements being iterated over.

type IntoIter = IntoIter<Y, F>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl<Y, F> !Send for Gen<Y, F>

impl<Y, F> !Sync for Gen<Y, F>

impl<Y, F> Unpin for Gen<Y, F>

impl<Y, F> !UnwindSafe for Gen<Y, F>

impl<Y, F> !RefUnwindSafe for Gen<Y, F>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]