pub struct Audited<T: Entity> { /* private fields */ }Expand description
A wrapper that carries a mandatory audit comment with an entity.
Only Audited<T> has a .save() method — bare entities cannot be saved directly.
This enforces the “must comment on save” policy at compile time.
Implementations§
Source§impl<T: Entity> Audited<T>
impl<T: Entity> Audited<T>
Sourcepub fn new(entity: T, comment: impl Into<String>) -> Self
pub fn new(entity: T, comment: impl Into<String>) -> Self
Create an audited wrapper with a validated, request-owned root reason.
The fluent constructor remains infallible in its type signature, but
invalid input panics with the same code, location and repair guidance as
MutationIntent. Callers handling untrusted input can validate it with
MutationIntent::new before constructing this wrapper.
Sourcepub fn entity_mut(&mut self) -> &mut T
pub fn entity_mut(&mut self) -> &mut T
Access the inner entity by mutable reference.
Sourcepub fn into_entity(self) -> T
pub fn into_entity(self) -> T
Consume and return the inner entity with comment applied.
Sourcepub fn get_comment(&self) -> &str
pub fn get_comment(&self) -> &str
Get the comment.
Auto Trait Implementations§
impl<T> Freeze for Audited<T>where
T: Freeze,
impl<T> RefUnwindSafe for Audited<T>where
T: RefUnwindSafe,
impl<T> Send for Audited<T>where
T: Send,
impl<T> Sync for Audited<T>where
T: Sync,
impl<T> Unpin for Audited<T>where
T: Unpin,
impl<T> UnsafeUnpin for Audited<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Audited<T>where
T: UnwindSafe,
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