pub struct LoggedCap<P>where
P: Permission,{ /* private fields */ }Expand description
An audited capability token that logs every exercise attempt.
Created via LoggedCap::new, which consumes a Cap<P> as proof of
possession. Every call to try_cap appends a
LogEntry to the shared audit log.
!Send + !Sync by default — use make_send for
cross-thread transfer. Cloning shares the same audit log: entries from
any clone appear in the same log.
Implementations§
Source§impl<P> LoggedCap<P>where
P: Permission,
impl<P> LoggedCap<P>where
P: Permission,
Sourcepub fn new(_cap: Cap<P>) -> LoggedCap<P>
pub fn new(_cap: Cap<P>) -> LoggedCap<P>
Creates an audited capability by consuming a Cap<P> as proof of possession.
Sourcepub fn try_cap(&self) -> Result<Cap<P>, CapSecError>
pub fn try_cap(&self) -> Result<Cap<P>, CapSecError>
Attempts to obtain a Cap<P> and records the attempt in the audit log.
Always succeeds (since LoggedCap wraps a Cap<P> directly). The
granted field in the log entry is always true.
Sourcepub fn entry_count(&self) -> usize
pub fn entry_count(&self) -> usize
Returns the number of entries in the audit log.
Sourcepub fn make_send(self) -> LoggedSendCap<P>
pub fn make_send(self) -> LoggedSendCap<P>
Converts this capability into a LoggedSendCap that can cross thread boundaries.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for LoggedCap<P>
impl<P> RefUnwindSafe for LoggedCap<P>where
P: RefUnwindSafe,
impl<P> !Send for LoggedCap<P>
impl<P> !Sync for LoggedCap<P>
impl<P> Unpin for LoggedCap<P>where
P: Unpin,
impl<P> UnsafeUnpin for LoggedCap<P>
impl<P> UnwindSafe for LoggedCap<P>where
P: 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