pub struct AuthorityScope { /* private fields */ }Expand description
A scope is a set of capabilities — the bounded authority a
Principal::Delegate may exercise relative to its authorizing
principal. ADR-0019 §Authority chain composition rule 1: a delegate’s
scope MUST be a subset of the authorizing principal’s effective scope.
Backed by BTreeSet so the canonical URI form is deterministic
(sorted) and round-trips byte-stably.
Implementations§
Source§impl AuthorityScope
impl AuthorityScope
Sourcepub fn empty() -> Self
pub fn empty() -> Self
Empty scope — useful for Operator/Platform/Federated
principals (their “effective scope” for composition purposes is
“all known capabilities”, represented by AuthorityScope::root).
Sourcepub fn root() -> Self
pub fn root() -> Self
Scope containing every known capability. The effective scope a
non-Delegate principal exposes to a downstream delegate per
ADR-0019 §Authority chain composition rule 1.
Sourcepub fn from_capabilities<I: IntoIterator<Item = Capability>>(caps: I) -> Self
pub fn from_capabilities<I: IntoIterator<Item = Capability>>(caps: I) -> Self
Build a scope from an explicit capability list.
pub fn contains(&self, cap: &Capability) -> bool
Sourcepub fn is_superset_of(&self, other: &AuthorityScope) -> bool
pub fn is_superset_of(&self, other: &AuthorityScope) -> bool
Returns true iff every capability in other is reachable from
self — other ⊆ self. The composition rule predicate.
pub fn iter(&self) -> impl Iterator<Item = &Capability>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
Trait Implementations§
Source§impl Clone for AuthorityScope
impl Clone for AuthorityScope
Source§fn clone(&self) -> AuthorityScope
fn clone(&self) -> AuthorityScope
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 AuthorityScope
impl Debug for AuthorityScope
Source§impl Default for AuthorityScope
impl Default for AuthorityScope
Source§fn default() -> AuthorityScope
fn default() -> AuthorityScope
Source§impl<'de> Deserialize<'de> for AuthorityScope
impl<'de> Deserialize<'de> for AuthorityScope
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>,
Source§impl PartialEq for AuthorityScope
impl PartialEq for AuthorityScope
Source§fn eq(&self, other: &AuthorityScope) -> bool
fn eq(&self, other: &AuthorityScope) -> bool
self and other values to be equal, and is used by ==.