pub struct MemorySink { /* private fields */ }Expand description
In-memory audit sink, useful for testing and querying.
Implementations§
Source§impl MemorySink
impl MemorySink
Sourcepub fn dropped_count(&self) -> u64
pub fn dropped_count(&self) -> u64
Number of events that were dropped due to overflow.
Sourcepub fn events(&self) -> Vec<AuditEvent>
pub fn events(&self) -> Vec<AuditEvent>
All stored events.
Sourcepub fn query_by_principal(&self, principal: &str) -> Vec<AuditEvent>
pub fn query_by_principal(&self, principal: &str) -> Vec<AuditEvent>
Query events by principal.
Sourcepub fn query_by_decision(&self, decision: AuditDecision) -> Vec<AuditEvent>
pub fn query_by_decision(&self, decision: AuditDecision) -> Vec<AuditEvent>
Query events by decision.
Sourcepub fn query_by_resource(&self, resource: &str) -> Vec<AuditEvent>
pub fn query_by_resource(&self, resource: &str) -> Vec<AuditEvent>
Query events by resource.
Sourcepub fn query_by_time_range(&self, min_ts: i64, max_ts: i64) -> Vec<AuditEvent>
pub fn query_by_time_range(&self, min_ts: i64, max_ts: i64) -> Vec<AuditEvent>
Query events within a time range.
Sourcepub fn drain(&self) -> Vec<AuditEvent>
pub fn drain(&self) -> Vec<AuditEvent>
Drain all events.
Sourcepub fn fill_ratio(&self) -> f64
pub fn fill_ratio(&self) -> f64
Fraction of capacity currently used (0.0 – 1.0).
Trait Implementations§
Source§impl AuditSink for MemorySink
impl AuditSink for MemorySink
Auto Trait Implementations§
impl !Freeze for MemorySink
impl !RefUnwindSafe for MemorySink
impl Send for MemorySink
impl Sync for MemorySink
impl Unpin for MemorySink
impl UnsafeUnpin for MemorySink
impl UnwindSafe for MemorySink
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
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