pub struct Capability {
pub id: CapabilityId,
pub resource: ResourceRef,
pub rights: Rights,
pub issuer: Issuer,
}Expand description
An unforgeable token encoding authority over a specific resource.
A capability binds a set of Rights to a ResourceRef, and records
who issued it. Agents present capabilities to the AccessManager to
prove they are authorised to perform an action.
§Immutability
Capabilities are immutable once created. To change rights, create a new capability and replace the old one in the CSpace.
Fields§
§id: CapabilityIdUnique identifier for this capability.
resource: ResourceRefThe resource this capability governs.
rights: RightsThe rights granted over the resource.
issuer: IssuerWho issued this capability.
Implementations§
Source§impl Capability
impl Capability
Sourcepub fn kernel(resource: ResourceRef, rights: Rights) -> Self
pub fn kernel(resource: ResourceRef, rights: Rights) -> Self
Creates a new kernel-issued capability with the given resource and rights.
Sourcepub fn delegated(resource: ResourceRef, rights: Rights, issuer: AgentId) -> Self
pub fn delegated(resource: ResourceRef, rights: Rights, issuer: AgentId) -> Self
Creates a new agent-issued capability (delegation).
Trait Implementations§
Source§impl Clone for Capability
impl Clone for Capability
Source§fn clone(&self) -> Capability
fn clone(&self) -> Capability
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Capability
impl Debug for Capability
Source§impl<'de> Deserialize<'de> for Capability
impl<'de> Deserialize<'de> for Capability
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Capability
impl RefUnwindSafe for Capability
impl Send for Capability
impl Sync for Capability
impl Unpin for Capability
impl UnsafeUnpin for Capability
impl UnwindSafe for Capability
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