pub struct Scope(/* private fields */);Expand description
Re-exported so macro-generated code (R-1: #[plexus::method(scope = "...")])
can construct RequiredCredential scope values through plexus-core’s
path alone — consumers don’t need a direct plexus-auth-core dependency
(the umbrella path ::plexus_rpc::core::plexus::schema::Scope also
resolves, per Z2H-2).
Atomic capability identifier, e.g. cone.send_message. Canonical
Scope newtype pinned by AUTHZ-S01-output §1. The grammar-validated
constructor (Scope::try_new), wildcard predicate (is_wildcard),
and segment-bounded matching (Scope::matches) live in
crate::scope_registry (AUTHZ-CORE-4). The macro-generated
Scope::new below stays unvalidated for wire-decoded values;
registry construction goes through try_new.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn try_new(s: impl Into<String>) -> Result<Scope, ScopeError>
pub fn try_new(s: impl Into<String>) -> Result<Scope, ScopeError>
Construct a Scope, validating the canonical grammar.
Accepts: bare *, dot-separated lowercase identifiers (each segment
[a-z][a-z0-9_]*), and an optional trailing .* segment wildcard.
Rejects everything else with a ScopeError carrying the offending
input.
Per AUTHZ-CORE-4. The pre-existing unvalidated Scope::new
constructor remains for wire-decoded values; registry construction
goes through this validating path.
Sourcepub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
True for the bare * and for any <prefix>.* form.
Sourcepub fn matches(&self, required: &Scope) -> bool
pub fn matches(&self, required: &Scope) -> bool
Does the holder of self satisfy the requirement required?
Returns true iff:
selfis the bare*(matches everything), ORself == required(exact match), ORselfends with.*AND its prefix-without-.*is a segment-prefix ofrequired.
Segment-prefix matching is the subtle case: cone.* matches
cone.send_message AND cone.threads.list (multiple downstream
segments) but does NOT match cone_extended.thing — the . boundary
is mandatory. A plain string-prefix check would silently match
cone_extended.thing; that is the exemplar trap AUTHZ-CORE-6’s
boundary test pins against.
The required side never carries wildcards in practice (a method’s
required scope is concrete); the holder side may. A required * is
only satisfied by a held * (via the bare-* arm).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Scope
impl<'de> Deserialize<'de> for Scope
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Scope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Scope, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Scope
Source§impl JsonSchema for Scope
impl JsonSchema for Scope
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Ord for Scope
impl Ord for Scope
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Scope
impl PartialOrd for Scope
Source§impl Serialize for Scope
impl Serialize for Scope
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl Forget for Scope
impl Freeze for Scope
impl Move for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
impl UnwindSafe for Scope
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.