pub struct Caveats(pub BTreeMap<String, CaveatValue>);Expand description
Opaque restriction map attached to a capability (UCAN “caveats”).
Milestone-1 semantics are deliberately conservative and value-blind: a child
capability’s caveats must be a superset (more restrictive) of — or equal
to — the parent’s. I.e. a child may add restrictions or repeat the
parent’s, but may never drop or loosen one. Concretely Caveats::covers
requires every parent key to be present in the child with a byte-identical
value; the child may carry extra keys (extra restrictions).
The value-aware algebra (a child {"max": 5} being covered by a parent
{"max": 10}) is deferred — see the module docs. Until then we never widen
on caveats, which is the fail-closed direction.
Tuple Fields§
§0: BTreeMap<String, CaveatValue>Implementations§
Source§impl Caveats
impl Caveats
pub fn is_empty(&self) -> bool
Sourcepub fn covers(&self, child: &Caveats) -> bool
pub fn covers(&self, child: &Caveats) -> bool
Does self (the parent’s caveats) permit a child carrying
child caveats? True iff every restriction the parent imposes is also
imposed, identically, by the child — the child may add more but never
drop or change one. Fail-closed (value-blind in milestone 1).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Caveats
impl<'de> Deserialize<'de> for Caveats
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 Caveats
impl StructuralPartialEq for Caveats
Auto Trait Implementations§
impl Freeze for Caveats
impl RefUnwindSafe for Caveats
impl Send for Caveats
impl Sync for Caveats
impl Unpin for Caveats
impl UnsafeUnpin for Caveats
impl UnwindSafe for Caveats
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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