pub struct PermissionRule {
pub tool_name: String,
pub decision: RuleDecision,
pub command_prefix: Option<String>,
pub cwd_prefix: Option<PathBuf>,
}Expand description
A single permission rule. Use the constructor / builder methods to build one.
Fields§
§tool_name: StringTool name to match. Trailing * makes it a prefix pattern; * alone matches any tool.
decision: RuleDecisionDecision applied when this rule matches.
command_prefix: Option<String>If set, the rule only matches when the call’s command argument starts with this prefix.
cwd_prefix: Option<PathBuf>If set, the rule only matches when the runtime cwd is inside this directory.
Implementations§
Source§impl PermissionRule
impl PermissionRule
Sourcepub fn allow_tool(name: impl Into<String>) -> Self
pub fn allow_tool(name: impl Into<String>) -> Self
Build an Allow rule for the given tool name.
Sourcepub fn command_prefix(self, prefix: impl Into<String>) -> Self
pub fn command_prefix(self, prefix: impl Into<String>) -> Self
Narrow the rule to calls whose command argument starts with prefix.
Sourcepub fn cwd_prefix(self, prefix: impl Into<PathBuf>) -> Self
pub fn cwd_prefix(self, prefix: impl Into<PathBuf>) -> Self
Narrow the rule to calls executed inside (or below) prefix.
Trait Implementations§
Source§impl Clone for PermissionRule
impl Clone for PermissionRule
Source§fn clone(&self) -> PermissionRule
fn clone(&self) -> PermissionRule
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PermissionRule
impl RefUnwindSafe for PermissionRule
impl Send for PermissionRule
impl Sync for PermissionRule
impl Unpin for PermissionRule
impl UnsafeUnpin for PermissionRule
impl UnwindSafe for PermissionRule
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