Skip to main content

Scope

Trait Scope 

Source
pub trait Scope: 'static {
    // Required method
    fn check(&self, target: &str) -> Result<(), CapSecError>;
}
Expand description

A restriction that narrows the set of targets a capability can act on.

Implement this trait to define custom scopes. The check method returns Ok(()) if the target is within scope, or an error if not.

Required Methods§

Source

fn check(&self, target: &str) -> Result<(), CapSecError>

Checks whether target is within this scope.

Returns Ok(()) if allowed, Err(CapSecError::OutOfScope) if not.

Implementors§