pub struct Audited<T: Entity> { /* private fields */ }Expand description
A wrapper that carries a mandatory audit comment with an entity.
Only Commented<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 a new Commented wrapper. Panics if comment is empty.
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