Skip to main content

Audited

Struct Audited 

Source
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>

Source

pub fn new(entity: T, comment: impl Into<String>) -> Self

Create a new Commented wrapper. Panics if comment is empty.

Source

pub fn entity(&self) -> &T

Access the inner entity by reference.

Source

pub fn entity_mut(&mut self) -> &mut T

Access the inner entity by mutable reference.

Source

pub fn into_entity(self) -> T

Consume and return the inner entity with comment applied.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.