Skip to content

Commit

Permalink
Lift redundant Sized requirements on event::Sourcing blanket impls (#5,
Browse files Browse the repository at this point in the history
  • Loading branch information
tyranron committed Sep 3, 2021
1 parent 1201086 commit 6750ebb
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions core/src/es/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,25 @@ pub trait Sourcing<S: ?Sized> {
fn apply_to(&self, state: &mut S);
}

impl<Ev, S: ?Sized> Sourcing<S> for Ev
where
S: Sourced<Ev>,
{
impl<Ev: ?Sized, S: Sourced<Ev> + ?Sized> Sourcing<S> for Ev {
fn apply_to(&self, state: &mut S) {
state.apply(self);
}
}

impl<'e, S> Sourced<dyn Sourcing<S> + 'e> for S {
impl<'e, S: ?Sized> Sourced<dyn Sourcing<S> + 'e> for S {
fn apply(&mut self, event: &(dyn Sourcing<S> + 'e)) {
event.apply_to(self);
}
}

impl<'e, S> Sourced<dyn Sourcing<S> + Send + 'e> for S {
impl<'e, S: ?Sized> Sourced<dyn Sourcing<S> + Send + 'e> for S {
fn apply(&mut self, event: &(dyn Sourcing<S> + Send + 'e)) {
event.apply_to(self);
}
}

impl<'e, S> Sourced<dyn Sourcing<S> + Send + Sync + 'e> for S {
impl<'e, S: ?Sized> Sourced<dyn Sourcing<S> + Send + Sync + 'e> for S {
fn apply(&mut self, event: &(dyn Sourcing<S> + Send + Sync + 'e)) {
event.apply_to(self);
}
Expand Down

0 comments on commit 6750ebb

Please sign in to comment.