Enum core::ops::CoroutineState
source · pub enum CoroutineState<Y, R> {
Yielded(Y),
Complete(R),
}
coroutine_trait
#43122)Expand description
The result of a coroutine resumption.
This enum is returned from the Coroutine::resume
method and indicates the
possible return values of a coroutine. Currently this corresponds to either
a suspension point (Yielded
) or a termination point (Complete
).
Variants§
Yielded(Y)
coroutine_trait
#43122)The coroutine suspended with a value.
This state indicates that a coroutine has been suspended, and typically
corresponds to a yield
statement. The value provided in this variant
corresponds to the expression passed to yield
and allows coroutines to
provide a value each time they yield.
Complete(R)
coroutine_trait
#43122)The coroutine completed with a return value.
This state indicates that a coroutine has finished execution with the
provided value. Once a coroutine has returned Complete
it is
considered a programmer error to call resume
again.
Trait Implementations§
source§impl<Y: Clone, R: Clone> Clone for CoroutineState<Y, R>
impl<Y: Clone, R: Clone> Clone for CoroutineState<Y, R>
source§fn clone(&self) -> CoroutineState<Y, R>
fn clone(&self) -> CoroutineState<Y, R>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Y: Ord, R: Ord> Ord for CoroutineState<Y, R>
impl<Y: Ord, R: Ord> Ord for CoroutineState<Y, R>
source§fn cmp(&self, other: &CoroutineState<Y, R>) -> Ordering
fn cmp(&self, other: &CoroutineState<Y, R>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<Y: PartialEq, R: PartialEq> PartialEq for CoroutineState<Y, R>
impl<Y: PartialEq, R: PartialEq> PartialEq for CoroutineState<Y, R>
source§fn eq(&self, other: &CoroutineState<Y, R>) -> bool
fn eq(&self, other: &CoroutineState<Y, R>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<Y: PartialOrd, R: PartialOrd> PartialOrd for CoroutineState<Y, R>
impl<Y: PartialOrd, R: PartialOrd> PartialOrd for CoroutineState<Y, R>
source§fn partial_cmp(&self, other: &CoroutineState<Y, R>) -> Option<Ordering>
fn partial_cmp(&self, other: &CoroutineState<Y, R>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more