#[non_exhaustive]pub enum Change<'a, E> {
Created {
after: &'a mut E,
},
Updated {
before: &'a E,
after: &'a mut E,
},
Transitioned {
before: &'a E,
after: &'a mut E,
transition: String,
field: String,
from: Option<String>,
to: Option<String>,
},
Deleted {
before: &'a E,
hard: bool,
},
Restored {
entity: &'a E,
},
}Expand description
One row change, as a write hook sees it.
In WriteHooks::before the row to be stored is mutable: a hook may fill a derived field.
In WriteHooks::after it is the row as stored. Matching on it needs a wildcard arm; kinds
may be added.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Created
A row is created.
Updated
A row is changed by a generic write (PUT, PATCH or their bulk forms).
Transitioned
A row is moved by a state-machine verb.
Fields
Deleted
A row is deleted: soft-deleted, or removed for good when hard.
Fields
Restored
A soft-deleted row is restored.
Implementations§
Source§impl<'a, E> Change<'a, E>
impl<'a, E> Change<'a, E>
Sourcepub fn after_mut(&mut self) -> Option<&mut E>
pub fn after_mut(&mut self) -> Option<&mut E>
The row to store, mutable: for a hook that fills a field before the write. None for a
delete or a restore, which store no new row.
Sourcepub fn before_and_after_mut(&mut self) -> Option<(&E, &mut E)>
pub fn before_and_after_mut(&mut self) -> Option<(&E, &mut E)>
The row as it was read and the row to store, the second mutable: for a hook that fills a
field of an update from what it was. None unless the change is an update.
Trait Implementations§
Auto Trait Implementations§
impl<'a, E> !UnwindSafe for Change<'a, E>
impl<'a, E> Freeze for Change<'a, E>
impl<'a, E> RefUnwindSafe for Change<'a, E>
impl<'a, E> Send for Change<'a, E>
impl<'a, E> Sync for Change<'a, E>
impl<'a, E> Unpin for Change<'a, E>
impl<'a, E> UnsafeUnpin for Change<'a, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more