pub fn replay<S: State>(
history: impl IntoIterator<Item = S::Event>,
) -> Result<S, Permanent>Expand description
Folds a sequence of events into a state, starting from Default. It is
meant for tests, where the history is at hand as typed events.
Every event is written as JSON and read back before the state evolves by
it, exactly as executing a command and reading the state again would, so a
field that does not survive that, such as one serde skips, shows up in a
test rather than in production. If the state starts from the latest event
of a type (see State::from_latest), so does this.
ยงErrors
Fails permanently if an event can not be written or read back.