From 145a99ab0b4d38ac0b27ac48b2e08133ce494dde Mon Sep 17 00:00:00 2001 From: Ivan Dugalic Date: Sat, 25 Jan 2025 17:10:06 +0100 Subject: [PATCH] added identifier implementation for the Sum struct --- src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 6890301..0c74fbe 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -347,3 +347,16 @@ pub trait Identifier { /// Returns the identifier of the state/command/event fn identifier(&self) -> String; } + +impl Identifier for Sum +where + A: Identifier, + B: Identifier, +{ + fn identifier(&self) -> String { + match self { + Sum::First(a) => a.identifier(), + Sum::Second(b) => b.identifier(), + } + } +}