pub struct TimedSendCap<P: Permission> { /* private fields */ }Expand description
A thread-safe time-bounded capability token.
Created via TimedCap::make_send. Unlike TimedCap, this implements
Send + Sync, making it usable with std::thread::spawn, tokio::spawn, etc.
Implementations§
Source§impl<P: Permission> TimedSendCap<P>
impl<P: Permission> TimedSendCap<P>
Sourcepub fn try_cap(&self) -> Result<Cap<P>, CapSecError>
pub fn try_cap(&self) -> Result<Cap<P>, CapSecError>
Attempts to obtain a Cap<P> from this timed capability.
Returns Ok(Cap<P>) if the TTL has not elapsed, or Err(CapSecError::Expired)
if the capability has expired.
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Advisory check — returns true if the capability has not yet expired.
The result is immediately stale; do not use for control flow.
Sourcepub fn remaining(&self) -> Duration
pub fn remaining(&self) -> Duration
Returns the remaining duration before expiry.
Returns Duration::ZERO if the capability has already expired.
Trait Implementations§
Source§impl<P: Permission> Clone for TimedSendCap<P>
impl<P: Permission> Clone for TimedSendCap<P>
impl<P: Permission> Send for TimedSendCap<P>
impl<P: Permission> Sync for TimedSendCap<P>
Auto Trait Implementations§
impl<P> Freeze for TimedSendCap<P>
impl<P> RefUnwindSafe for TimedSendCap<P>where
P: RefUnwindSafe,
impl<P> Unpin for TimedSendCap<P>where
P: Unpin,
impl<P> UnsafeUnpin for TimedSendCap<P>
impl<P> UnwindSafe for TimedSendCap<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