Skip to content

Commit

Permalink
added identifier implementation for the Sum struct
Browse files Browse the repository at this point in the history
  • Loading branch information
idugalic committed Jan 25, 2025
1 parent f7a4faf commit 145a99a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,16 @@ pub trait Identifier {
/// Returns the identifier of the state/command/event
fn identifier(&self) -> String;
}

impl<A, B> Identifier for Sum<A, B>
where
A: Identifier,
B: Identifier,
{
fn identifier(&self) -> String {
match self {
Sum::First(a) => a.identifier(),
Sum::Second(b) => b.identifier(),
}
}
}

0 comments on commit 145a99a

Please sign in to comment.