pub struct KindSet(Repr);Expand description
The core’s own types, re-exported: every field of
record::ParsedPolicy is one of these, so a caller that declares a
policy reaches them through this crate rather than depending on
didbot-policy for the names alone.
Which account kinds a write-shaped applicability declaration covers.
plan/policy.md lists “subject kinds” among applicability’s declarative
dimensions alongside collections, path prefixes and action kinds; this
is that dimension. Filtering here rather than inside every evaluator
means a policy that only makes sense for agents routes a host’s write
past it entirely — the tree walk, not an Allow an evaluator had to
compute — which keeps the empty-match property doing real work for the
kinds a policy does not cover, not just for collections it does not
cover.
§Naming specific kinds does not cover an unrecognized one
bot.did.registration’s actor union is open, so a subject can carry a
SubjectKind::Unknown this
build has never heard of. of builds a set from named
AccountKinds, and such a set never matches an unknown kind, no
matter which kinds it names — not even by naming all four.
This is deliberate, and the conservative-sounding instinct is the
opposite: a rule declared over [Agent] made a claim about agents. In a
deny-only system, silently stretching that claim to cover a kind its
author had never seen would deny writes on a premise nobody established
— the same shape of mistake as inventing what a delete means instead of
routing on an explicit WriteAction. ANY is how an
author opts a policy into kinds invented after it was written, and it is
the only way to.
Tuple Fields§
§0: ReprImplementations§
Source§impl KindSet
impl KindSet
Sourcepub const ALL: KindSet
pub const ALL: KindSet
All four kinds this build recognizes by name — but, per this type’s
doc comment, not a kind it does not. For that, use ANY.
Sourcepub const ANY: KindSet
pub const ANY: KindSet
Every kind matches, including one this build has never heard of. The explicit opt-in a policy names to cover kinds invented after it was written.
Sourcepub fn of(kinds: &[AccountKind]) -> KindSet
pub fn of(kinds: &[AccountKind]) -> KindSet
Only the given known kinds match — never an unrecognized one, no matter which kinds are named.
Sourcepub fn contains(&self, kind: SubjectKind<'_>) -> bool
pub fn contains(&self, kind: SubjectKind<'_>) -> bool
Whether kind is in this set.
Trait Implementations§
impl Copy for KindSet
impl Eq for KindSet
impl StructuralPartialEq for KindSet
Auto Trait Implementations§
impl Freeze for KindSet
impl RefUnwindSafe for KindSet
impl Send for KindSet
impl Sync for KindSet
impl Unpin for KindSet
impl UnsafeUnpin for KindSet
impl UnwindSafe for KindSet
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
§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<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