pub trait Command<S> {
type Result;
type Event: Event<S>;
// Required method
fn decide(self, state: &S, events: &mut Vec<Self::Event>) -> Self::Result;
}
Expand description
A command that encodes a request to update a layer’s state
Required Associated Types§
Sourcetype Result
type Result
The direct result of processing a command that is returned to the caller
Changes to the state that result from a command are encoded as events
(see Command::Event
). In addition to that, a command may return
information to the caller, and Result
defines the type of that
information.
Sourcetype Event: Event<S>
type Event: Event<S>
An event that encodes a change to the state
Events are produced by Command::decide
and processed by
Event::evolve
.