Enum core::ops::GeneratorState[−][src]

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

返回值的副本。 Read more

从 source 执行复制分配。 Read more

使用给定的格式化程序格式化该值。 Read more

将该值输入给定的 Hasher。 Read more

将这种类型的切片送入给定的 Hasher 中。 Read more

此方法返回 self 和 other 之间的 Ordering。 Read more

比较并返回两个值中的最大值。 Read more

比较并返回两个值中的最小值。 Read more

将值限制为一定的时间间隔。 Read more

此方法测试 self 和 other 值是否相等,并由 == 使用。 Read more

此方法测试 !=。

如果存在,则此方法返回 self 和 other 值之间的顺序。 Read more

此方法测试的内容少于 (对于 self 和 other),并且由 < 操作员使用。 Read more

此方法测试小于或等于 (对于 self 和 other),并且由 <= 运算符使用。 Read more

此方法测试大于 (对于 self 和 other),并且由 > 操作员使用。 Read more

此方法测试是否大于或等于 (对于 self 和 other),并且由 >= 运算符使用。 Read more

Auto Trait Implementations

Blanket Implementations

获取 self 的 TypeId。 Read more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。