pub struct AuditLog { /* private fields */ }Expand description
An append-only audit log. Events are never removed once recorded.
Implementations§
Source§impl AuditLog
impl AuditLog
Sourcepub fn record(&mut self, event: AuditEvent)
pub fn record(&mut self, event: AuditEvent)
Appends an event to the log.
Sourcepub fn events(&self) -> &[AuditEvent]
pub fn events(&self) -> &[AuditEvent]
Returns all recorded events in insertion order.
Sourcepub fn to_json(&self) -> Result<String, Error>
pub fn to_json(&self) -> Result<String, Error>
Serializes the entire log to a JSON string.
§Errors
Returns a serde_json::Error if serialization fails.
Sourcepub fn events_of_kind(&self, kind: &str) -> Vec<&AuditEvent>
pub fn events_of_kind(&self, kind: &str) -> Vec<&AuditEvent>
Returns all events whose kind label matches kind.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuditLog
impl RefUnwindSafe for AuditLog
impl Send for AuditLog
impl Sync for AuditLog
impl Unpin for AuditLog
impl UnsafeUnpin for AuditLog
impl UnwindSafe for AuditLog
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