Skip to main content

GenReplay

Struct GenReplay 

Source
struct GenReplay {
    sent: Vec<GenCompletion>,
    counter: usize,
    target: usize,
    suspending: bool,
    yielded: Value,
    returning: Option<Value>,
}
Expand description

generator 本体の replay 実行中に保持する一時状態。

resume のたびに本体を先頭から再実行し、target 番目の yield で中断(suspend)する。 それより手前の yield には sent に保存済みの resume 値を返して通過させる。

Fields§

§sent: Vec<GenCompletion>

既に通過した各 yield の resume 結果。

§counter: usize

この replay でこれまでに遭遇した yield 数。

§target: usize

この index の yield に達したら中断する(= sent.len())。

§suspending: bool

中断(suspend)中フラグ。Err を最上位まで巻き戻すための番兵。

§yielded: Value

中断地点で yield された値。

§returning: Option<Value>

強制Return時の戻り値を一時保持する。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.