pub struct RuntimeCap<P: Permission> { /* private fields */ }Expand description
A revocable capability token proving the holder has permission P.
Created via RuntimeCap::new, which consumes a Cap<P> as proof of
possession and returns a (RuntimeCap<P>, Revoker) pair.
!Send + !Sync by default — use make_send for
cross-thread transfer. Cloning shares the same revocation state: revoking
one clone revokes all of them.
Implementations§
Source§impl<P: Permission> RuntimeCap<P>
impl<P: Permission> RuntimeCap<P>
Sourcepub fn new(_cap: Cap<P>) -> (Self, Revoker)
pub fn new(_cap: Cap<P>) -> (Self, Revoker)
Creates a revocable capability by consuming a Cap<P> as proof of possession.
Returns a (RuntimeCap<P>, Revoker) pair. The Revoker can invalidate
this capability (and all its clones) from any thread.
Sourcepub fn try_cap(&self) -> Result<Cap<P>, CapSecError>
pub fn try_cap(&self) -> Result<Cap<P>, CapSecError>
Sourcepub fn is_active(&self) -> bool
pub fn is_active(&self) -> bool
Advisory check — returns true if the capability has not been revoked.
The result is immediately stale; do not use for control flow.
Always use try_cap for actual access.
Sourcepub fn make_send(self) -> RuntimeSendCap<P>
pub fn make_send(self) -> RuntimeSendCap<P>
Converts this capability into a RuntimeSendCap that can cross thread boundaries.
This is an explicit opt-in — you’re acknowledging that this capability will be used in a multi-threaded context.