pub trait Generatable<T>: Iterator<Item = Cancellable<T>> {
// Required method
fn try_next(&mut self) -> Option<Completable<T>>;
// Provided method
fn dyn_generatable(self) -> DynGeneratable<T>
where Self: Sized + 'static { ... }
}Expand description
An alternative to crate::Computable which is intended for generators.
The computation is finished once Generatable::try_next returns None.
Required Methods§
Sourcefn try_next(&mut self) -> Option<Completable<T>>
fn try_next(&mut self) -> Option<Completable<T>>
Try to advance the generator and return the next item.
Returns:
Some(Ok(item))when an item is availableSome(Err(Incomplete::Suspended))when the generator needs to yield controlSome(Err(Incomplete::Cancelled(_)))when the computation was canceledNonewhen the generator is exhausted
Provided Methods§
Sourcefn dyn_generatable(self) -> DynGeneratable<T>where
Self: Sized + 'static,
fn dyn_generatable(self) -> DynGeneratable<T>where
Self: Sized + 'static,
Utility method to convert this Generatable to a dynamic type.