pub struct CapabilityIdIndex { /* private fields */ }Expand description
Canonical-id and alias index for a capability registry.
Owns the identity bookkeeping every registry needs: which canonical ids
exist, which legacy aliases resolve to them, and collision rejection when
a new registration would shadow an existing id or alias. Registries keep
their own id -> implementation storage and delegate identity questions
here so the Framework and the product resolve capability identity the
same way.
Implementations§
Source§impl CapabilityIdIndex
impl CapabilityIdIndex
Sourcepub fn insert(
&mut self,
canonical: impl Into<String>,
aliases: &[&str],
) -> Result<(), CapabilityError>
pub fn insert( &mut self, canonical: impl Into<String>, aliases: &[&str], ) -> Result<(), CapabilityError>
Insert a canonical id and its aliases, rejecting collisions.
Fails with CapabilityError::Duplicate when the canonical id (or
any alias) is already present as a canonical id or alias.
Sourcepub fn insert_or_replace(
&mut self,
canonical: impl Into<String>,
aliases: &[&str],
)
pub fn insert_or_replace( &mut self, canonical: impl Into<String>, aliases: &[&str], )
Insert a canonical id and its aliases, replacing an existing entry with the same canonical id (legacy registry override semantics).
Sourcepub fn canonical_of<'a>(&'a self, id: &'a str) -> Option<&'a str>
pub fn canonical_of<'a>(&'a self, id: &'a str) -> Option<&'a str>
Resolve an id or alias to its canonical id, if registered.
Sourcepub fn remove(&mut self, id: &str) -> Option<String>
pub fn remove(&mut self, id: &str) -> Option<String>
Remove an id (or alias) and everything resolving to its canonical id.
Returns the removed canonical id, if any.
Sourcepub fn canonical_ids(&self) -> impl Iterator<Item = &str>
pub fn canonical_ids(&self) -> impl Iterator<Item = &str>
Iterate the canonical ids in the index.
Trait Implementations§
Source§impl Clone for CapabilityIdIndex
impl Clone for CapabilityIdIndex
Source§fn clone(&self) -> CapabilityIdIndex
fn clone(&self) -> CapabilityIdIndex
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more