pub struct CapAttrs {
pub methods: BTreeSet<String>,
pub budget: Budget,
pub read_only: bool,
pub redact: bool,
pub path_scope: Option<String>,
pub tool_policy: Option<ToolPolicy>,
}Expand description
The authority a capability carries.
Fields§
§methods: BTreeSet<String>Granted method names. Must be non-empty after attenuation.
budget: BudgetResource budget.
read_only: boolMay not mutate module state.
redact: boolRedacts trace output.
path_scope: Option<String>Dotted path prefix the capability is confined to (inclusive).
tool_policy: Option<ToolPolicy>Tool policy, when the capability targets a tool.
Implementations§
Source§impl CapAttrs
impl CapAttrs
Sourcepub fn with_methods(self, methods: &[&str]) -> Self
pub fn with_methods(self, methods: &[&str]) -> Self
Restrict methods.
Sourcepub fn with_budget(self, budget: Budget) -> Self
pub fn with_budget(self, budget: Budget) -> Self
Restrict the budget.
Sourcepub fn with_path(self, path: impl Into<String>) -> Self
pub fn with_path(self, path: impl Into<String>) -> Self
Confine the capability to a path prefix.
Sourcepub fn with_tool_policy(self, policy: ToolPolicy) -> Self
pub fn with_tool_policy(self, policy: ToolPolicy) -> Self
Attach a tool policy.
Sourcepub fn is_attenuation_of(&self, parent: &CapAttrs) -> bool
pub fn is_attenuation_of(&self, parent: &CapAttrs) -> bool
True when self is a valid attenuation of parent.
Sourcepub fn attenuate(&self, child: CapAttrs) -> Result<CapAttrs>
pub fn attenuate(&self, child: CapAttrs) -> Result<CapAttrs>
Attenuate, refusing anything that would widen authority.
Sourcepub fn covers_path(&self, path: &str) -> bool
pub fn covers_path(&self, path: &str) -> bool
Whether path is inside the capability’s scope.
Trait Implementations§
impl Eq for CapAttrs
impl StructuralPartialEq for CapAttrs
Auto Trait Implementations§
impl Freeze for CapAttrs
impl RefUnwindSafe for CapAttrs
impl Send for CapAttrs
impl Sync for CapAttrs
impl Unpin for CapAttrs
impl UnsafeUnpin for CapAttrs
impl UnwindSafe for CapAttrs
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.