es_entity/idempotent.rs
1#[must_use]
2pub enum Idempotent<T> {
3 Executed(T),
4 AlreadyApplied,
5}
6
7impl<T> Idempotent<T> {
8 pub fn was_already_applied(&self) -> bool {
9 matches!(self, Idempotent::AlreadyApplied)
10 }
11
12 pub fn did_execute(&self) -> bool {
13 matches!(self, Idempotent::Executed(_))
14 }
15
16 pub fn unwrap(self) -> T {
17 match self {
18 Idempotent::Executed(t) => t,
19 Idempotent::AlreadyApplied => panic!("Idempotent::AlreadyApplied"),
20 }
21 }
22}