Enum std::ops::GeneratorState
source · pub enum GeneratorState<Y, R> {
Yielded(Y),
Complete(R),
}
🔬This is a nightly-only experimental API. (
generator_trait
#43122)Expand description
恢复生成器的结果。
该枚举从 Generator::resume
方法返回,并指示生成器的可能返回值。
当前,这对应于悬挂点 (Yielded
) 或终止点 (Complete
)。
Variants§
Yielded(Y)
🔬This is a nightly-only experimental API. (
generator_trait
#43122)生成器挂起了一个值。
此状态表明生成器已被挂起,并且通常对应于 yield
语句。
该变体中提供的值对应于传递给 yield
的表达式,并允许生成器在每次产生时提供一个值。
Complete(R)
🔬This is a nightly-only experimental API. (
generator_trait
#43122)生成器完成并返回一个值。
此状态表明生成器已使用提供的值完成了执行。
生成器返回 Complete
后,再次调用 resume
将被视为程序员错误。
Trait Implementations§
source§impl<Y, R> Clone for GeneratorState<Y, R>where
Y: Clone,
R: Clone,
impl<Y, R> Clone for GeneratorState<Y, R>where Y: Clone, R: Clone,
source§fn clone(&self) -> GeneratorState<Y, R>
fn clone(&self) -> GeneratorState<Y, R>
返回值的副本。 Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
从
source
执行复制分配。 Read moresource§impl<Y, R> Ord for GeneratorState<Y, R>where
Y: Ord,
R: Ord,
impl<Y, R> Ord for GeneratorState<Y, R>where Y: Ord, R: Ord,
source§fn cmp(&self, other: &GeneratorState<Y, R>) -> Ordering
fn cmp(&self, other: &GeneratorState<Y, R>) -> Ordering
source§impl<Y, R> PartialEq<GeneratorState<Y, R>> for GeneratorState<Y, R>where
Y: PartialEq<Y>,
R: PartialEq<R>,
impl<Y, R> PartialEq<GeneratorState<Y, R>> for GeneratorState<Y, R>where Y: PartialEq<Y>, R: PartialEq<R>,
source§impl<Y, R> PartialOrd<GeneratorState<Y, R>> for GeneratorState<Y, R>where
Y: PartialOrd<Y>,
R: PartialOrd<R>,
impl<Y, R> PartialOrd<GeneratorState<Y, R>> for GeneratorState<Y, R>where Y: PartialOrd<Y>, R: PartialOrd<R>,
impl<Y, R> Copy for GeneratorState<Y, R>where Y: Copy, R: Copy,
impl<Y, R> Eq for GeneratorState<Y, R>where Y: Eq, R: Eq,
impl<Y, R> StructuralEq for GeneratorState<Y, R>
impl<Y, R> StructuralPartialEq for GeneratorState<Y, R>
Auto Trait Implementations§
impl<Y, R> RefUnwindSafe for GeneratorState<Y, R>where R: RefUnwindSafe, Y: RefUnwindSafe,
impl<Y, R> Send for GeneratorState<Y, R>where R: Send, Y: Send,
impl<Y, R> Sync for GeneratorState<Y, R>where R: Sync, Y: Sync,
impl<Y, R> Unpin for GeneratorState<Y, R>where R: Unpin, Y: Unpin,
impl<Y, R> UnwindSafe for GeneratorState<Y, R>where R: UnwindSafe, Y: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
从拥有的值中借用。 Read more