Skip to main content

CapabilitySet

Struct CapabilitySet 

Source
pub struct CapabilitySet { /* private fields */ }
Expand description

Set of capabilities currently granted to a connection. Deterministically ordered (BTreeSet) so granted() returns a stable sequence — important for wire-level reproducibility and test assertions.

SP-observability-completeness-v1 Axis C: carries optional per-capability provenance alongside the granted set. The granted set is the result; provenance records the source of each grant (operator allow-list vs a UCAN chain link). Provenance is best-effort metadata for the audit sink — it never affects gating (which reads contains / granted only).

Implementations§

Source§

impl CapabilitySet

Source

pub fn empty() -> Self

Source

pub fn with_provenance<I>(granted: I, provenance: Vec<CapProvenance>) -> Self
where I: IntoIterator<Item = String>,

Construct a set from a granted iterable plus its provenance records. Used at Hello time so the audit sink can attribute each capability.

Source

pub fn contains(&self, cap: &str) -> bool

Source

pub fn granted(&self) -> Vec<String>

Sorted, deterministic view of the granted set.

Source

pub fn provenance(&self) -> &[CapProvenance]

Per-capability source attribution (SP-observability-completeness-v1 Axis C). Empty when provenance wasn’t recorded. A capability granted by both the string allow-list and a UCAN chain appears twice (once per source) — that’s the honest record.

Source

pub fn intersect(&self, requested: &[String]) -> (Vec<String>, Vec<String>)

Intersect requested with the server’s allow-list. Returns (granted_subset, denied_subset), each deterministically ordered. Used during the Hello handshake to decide what to echo back.

Source

pub fn union(&self, other: &Self) -> Self

Union two capability sets. Used by SP-capability-v2 dispatch to combine SP-12 string-allow-list results with UCAN-derived caps (spec §4.2: granted = granted_strings ∪ granted_ucan). Returns a new set; neither input is mutated.

Trait Implementations§

Source§

impl Clone for CapabilitySet

Source§

fn clone(&self) -> CapabilitySet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CapabilitySet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CapabilitySet

Source§

fn default() -> CapabilitySet

Returns the “default value” for a type. Read more
Source§

impl FromIterator<String> for CapabilitySet

Source§

fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> Self

Creates a value from an iterator. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V