pub trait CapabilityRef<'a>: Sized {
// Required methods
fn from_store(store: &'a CapabilityStore, id: CapabilityId) -> Self;
fn store(&self) -> &'a CapabilityStore;
fn id(&self) -> CapabilityId;
// Provided methods
fn duplicate(&'a self) -> impl Future<Output = Result<Self, Error>> { ... }
fn drop(self) -> impl Future<Output = Result<(), Error>> { ... }
fn export<T>(self) -> impl Future<Output = Result<T, Error>>
where T: Importable<'a, Ref = Self> { ... }
}Expand description
A reference to a fsandbox::Capability stored in a repository held by the
component framework.
This reference represents a capability of an unconfirmed type. Specify type
parameters on export() methods to derive the type.
Required Methods§
Sourcefn from_store(store: &'a CapabilityStore, id: CapabilityId) -> Self
fn from_store(store: &'a CapabilityStore, id: CapabilityId) -> Self
Create a CapabilityRef referencing the given store and id.
Warning: If the capability stored in the store at the given key is not
of type T, the type mismatch will only become apparent when attempting
to call CapabilityRef::export or call type-specific methods on it.
Sourcefn store(&self) -> &'a CapabilityStore
fn store(&self) -> &'a CapabilityStore
Return a reference to the store containing this Capability.
Provided Methods§
Sourcefn duplicate(&'a self) -> impl Future<Output = Result<Self, Error>>
fn duplicate(&'a self) -> impl Future<Output = Result<Self, Error>>
Duplicates the capability referenced by this ref, returning a new ref to the duplicated capability.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.