agent-capability-token · scope
Declared module signatures, types, configuration, and source documentation.
Source: act/agent-capability-token/src/scope.rs. SHA-256: 4958ce88d532883b39de4c8600bbf1dc51733ad13e92e0dc5c4b82b3b66ece7d.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
scope::WILDCARD
The wildcard segment, which matches any value in its position.
pub const WILDCARD: &str;Source line: 14.
scope::SCOPE_SEGMENTS
Number of colon-separated segments in a well-formed scope.
pub const SCOPE_SEGMENTS: usize;Source line: 17.
scope::Scope
A validated capability scope in service:resource:action form.
Serializes as a plain string, so the wire representation is a flat array of strings rather than a nested structure.
Examples
use agent_capability_token::Scope;
let scope: Scope = "tools:calendar:invoke".parse()?;
assert_eq!(scope.service(), "tools");
assert_eq!(scope.action(), "invoke");
// A granted wildcard covers a specific request.
let granted: Scope = "runtime:platform:*".parse()?;
let requested: Scope = "runtime:platform:spawn".parse()?;
assert!(granted.covers(&requested));
# Ok::<(), agent_capability_token::ActError>(())#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Scope {
}Source line: 40.
scope::Scope::parse
Parses and validates a scope string.
Errors
Returns [ActError::MalformedScope] unless the input has exactly three
non-empty colon-separated segments.
pub fn parse(value: impl Into<String>) -> ActResult<Self>;Source line: 54.
scope::Scope::service
The service segment.
#[must_use]
pub fn service(&self) -> &str;Source line: 91.
scope::Scope::resource
The resource segment.
#[must_use]
pub fn resource(&self) -> &str;Source line: 97.
scope::Scope::action
The action segment.
#[must_use]
pub fn action(&self) -> &str;Source line: 103.
scope::Scope::as_str
The scope as it appears on the wire.
#[must_use]
pub fn as_str(&self) -> &str;Source line: 109.
scope::Scope::covers
Whether this scope, treated as a grant, authorizes requested.
A [WILDCARD] segment in the grant matches any value in the same
position. The comparison is directional: a wildcard in requested is
matched literally, so a caller cannot widen its own authority by asking
for *.
#[must_use]
pub fn covers(&self, requested: &Self) -> bool;Source line: 120.