Skip to content

Commit

Permalink
Return Command::Result from Layer::process
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed Feb 15, 2024
1 parent 7154aac commit 8222147
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/fj-core/src/layers/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ impl<S> Layer<S> {
///
/// The command is processed synchronously. When this method returns, the
/// state has been updated.
pub fn process<C>(&mut self, command: C, events: &mut Vec<C::Event>)
pub fn process<C>(
&mut self,
command: C,
events: &mut Vec<C::Event>,
) -> C::Result
where
C: Command<S>,
{
command.decide(&self.state, events);
let result = command.decide(&self.state, events);

for event in events {
event.evolve(&mut self.state);
}

result
}

/// Drop this instance, returning the wrapped state
Expand Down

0 comments on commit 8222147

Please sign in to comment.