pub struct CapabilitySet { /* private fields */ }Expand description
A set of capabilities — declared by manifest, granted by loader.
The effective capability set is the intersection of declared and
granted. Registrations attempted without the corresponding capability in
the effective set fail with crate::PluginError::CapabilityRequired.
Implementations§
Source§impl CapabilitySet
impl CapabilitySet
Sourcepub fn from_iter_of(caps: impl IntoIterator<Item = Capability>) -> Self
pub fn from_iter_of(caps: impl IntoIterator<Item = Capability>) -> Self
Construct a capability set from an iterable.
Sourcepub fn from_manifest(caps: impl IntoIterator<Item = ManifestCapability>) -> Self
pub fn from_manifest(caps: impl IntoIterator<Item = ManifestCapability>) -> Self
Construct a capability set from guest-manifest declarations, each of
which may be a bare name or a structured ManifestCapability.
Sourcepub fn insert(&mut self, cap: Capability) -> bool
pub fn insert(&mut self, cap: Capability) -> bool
Insert a capability; returns true if the capability was not already present.
Sourcepub fn contains(&self, cap: &Capability) -> bool
pub fn contains(&self, cap: &Capability) -> bool
Check whether the set contains the given capability (exact equality).
Sourcepub fn contains_variant(&self, target: &Capability) -> bool
pub fn contains_variant(&self, target: &Capability) -> bool
Check whether the set contains a registration-gating capability.
Match is on the variant — contains_variant(Capability::ScalarFn)
returns true regardless of any associated data on other variants.
Useful for registrar gates like “any BackgroundJob { max_concurrent }
is sufficient regardless of the cap.”
Sourcepub fn intersect(&self, other: &Self) -> Self
pub fn intersect(&self, other: &Self) -> Self
Intersect this set with another, returning a new set.
The intersection is the effective capability set when manifest
declarations are intersected with host grants. Caps that match by
variant but differ in attenuation (e.g., two different Network { allow } patterns) are both retained — the runtime check enforces
each individually.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Capability>
pub fn iter(&self) -> impl Iterator<Item = &Capability>
Returns an iterator over the contained capabilities.
Trait Implementations§
Source§impl Clone for CapabilitySet
impl Clone for CapabilitySet
Source§fn clone(&self) -> CapabilitySet
fn clone(&self) -> CapabilitySet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CapabilitySet
impl Debug for CapabilitySet
Source§impl Default for CapabilitySet
impl Default for CapabilitySet
Source§fn default() -> CapabilitySet
fn default() -> CapabilitySet
Source§impl<'de> Deserialize<'de> for CapabilitySet
impl<'de> Deserialize<'de> for CapabilitySet
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>,
impl Eq for CapabilitySet
Source§impl PartialEq for CapabilitySet
impl PartialEq for CapabilitySet
Source§fn eq(&self, other: &CapabilitySet) -> bool
fn eq(&self, other: &CapabilitySet) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for CapabilitySet
impl Serialize for CapabilitySet
impl StructuralPartialEq for CapabilitySet
Auto Trait Implementations§
impl Freeze for CapabilitySet
impl RefUnwindSafe for CapabilitySet
impl Send for CapabilitySet
impl Sync for CapabilitySet
impl Unpin for CapabilitySet
impl UnsafeUnpin for CapabilitySet
impl UnwindSafe for CapabilitySet
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more