Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some tweaks in service code #1629

Merged
merged 2 commits into from
Feb 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions crates/fj-kernel/src/services/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ where
}
}

impl<S: State> Subscriber<S::Command> for Service<S> {
impl<S: State> Subscriber<S::Command> for Service<S>
where
S::Command: Clone,
{
fn handle_event(&mut self, event: &S::Command) {
self.execute(event.clone());
}
Expand All @@ -113,13 +116,13 @@ pub trait State {
/// A command that relates to the state
///
/// Commands are processed by [`State::decide`].
type Command: Clone;
type Command;

/// An event that captures modifications to this state
///
/// Events are produced by [`State::decide`] and processed by
/// [`State::evolve`].
type Event: Clone;
type Event;

/// Decide how to react to the provided command
///
Expand Down