pub trait StepsIter<O, A, F>: Iterator<Item = PartialStep<O, A, F>> {
// Provided methods
fn summarize(self) -> StepsSummary<F>
where Self: Sized,
F: Feedback { ... }
fn take_episodes(self, n: usize) -> TakeEpisodes<Self> ⓘ
where Self: Sized { ... }
fn take_aligned_steps(
self,
min_steps: usize,
slack: usize,
) -> TakeAlignedSteps<Self> ⓘ
where Self: Sized { ... }
fn fold_transient<B, G>(self, init: B, g: G) -> B
where G: FnMut(B, TransientStep<'_, O, A, F>) -> B,
Self: Sized { ... }
fn for_each_transient<G>(self, g: G)
where G: FnMut(TransientStep<'_, O, A, F>),
Self: Sized { ... }
fn map_transient<B, G>(self, g: G) -> MapTransient<Self, G> ⓘ
where G: FnMut(TransientStep<'_, O, A, G>) -> B,
Self: Sized { ... }
}
Expand description
An iterator of simulation steps.
Provided Methods§
Sourcefn summarize(self) -> StepsSummary<F>
fn summarize(self) -> StepsSummary<F>
Consume all steps and produce a summary of the step statistics.
Sourcefn take_episodes(self, n: usize) -> TakeEpisodes<Self> ⓘwhere
Self: Sized,
fn take_episodes(self, n: usize) -> TakeEpisodes<Self> ⓘwhere
Self: Sized,
Creates an iterator that yields steps from the first n
episodes.
Sourcefn take_aligned_steps(
self,
min_steps: usize,
slack: usize,
) -> TakeAlignedSteps<Self> ⓘwhere
Self: Sized,
fn take_aligned_steps(
self,
min_steps: usize,
slack: usize,
) -> TakeAlignedSteps<Self> ⓘwhere
Self: Sized,
Creates an iterator of at least min_steps
and at most min_steps + slack
steps.
Ends on the first episode boundary in this interval.
Sourcefn fold_transient<B, G>(self, init: B, g: G) -> B
fn fold_transient<B, G>(self, init: B, g: G) -> B
Fold each step viewed as a TransientStep
into an accumulator using a closure.
This is the equivalent of Iterator::fold
on an iterator of TransientStep
except that such an iterator cannot be created without generic associated types.
If the final step.next
is Successor::Continue
then that step is skipped since the
successor observation is missing. The code in this module avoids creating such an
abruptly-ending steps iterator but it is possible with the standard iterator methods like
take(n)
.
Sourcefn for_each_transient<G>(self, g: G)
fn for_each_transient<G>(self, g: G)
Call a closure on each step viewed as a TransientStep
.
This is the equivalent of Iterator::for_each
on an iterator of TransientStep
except that such an iterator cannot be created without generic associated types.
If the final step.next
is Successor::Continue
then that step is skipped since the
successor observation is missing. This situation should not arise if using take_episodes
or take_aligned_steps
.
Sourcefn map_transient<B, G>(self, g: G) -> MapTransient<Self, G> ⓘ
fn map_transient<B, G>(self, g: G) -> MapTransient<Self, G> ⓘ
Map each step viewed as a TransientStep
.
This is the equivalent of Iterator::map
on an iterator of TransientStep
except that such an iterator cannot be created without generic associated types.
If the final step.next
is Successor::Continue
then that step is skipped since the
successor observation is missing. This situation should not arise if using take_episodes
or take_aligned_steps
.