Skip to content

Commit

Permalink
feat: support inner for Event type
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-herlemont committed Dec 6, 2024
1 parent 88634a4 commit 96c8d93
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/watch/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ impl Event {
}
}

/// Get the inner value of the event
///
/// NOTE: for update, it returns the new value
impl Event {
pub fn inner<T: ToInput>(&self) -> Result<T> {
match self {
Event::Insert(insert) => insert.inner(),
Event::Update(update) => update.inner_new(),
Event::Delete(delete) => delete.inner(),
}
}
}

impl Debug for Event {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down

0 comments on commit 96c8d93

Please sign in to comment.