pub struct NativePolicy { /* private fields */ }Expand description
Native policy: closure-based rules (the zero-dependency default).
Implementations§
Source§impl NativePolicy
impl NativePolicy
Sourcepub fn new(
name: impl Into<String>,
rule: impl Fn(&str, &Value) -> PolicyDecision + Send + Sync + 'static,
) -> Self
pub fn new( name: impl Into<String>, rule: impl Fn(&str, &Value) -> PolicyDecision + Send + Sync + 'static, ) -> Self
Build from a rule closure.
Sourcepub fn deny_tools(tools: &[&str]) -> Self
pub fn deny_tools(tools: &[&str]) -> Self
Deny-list policy: block the named tools outright.
Sourcepub fn allow_only(tools: &[&str]) -> Self
pub fn allow_only(tools: &[&str]) -> Self
Allow-list policy: only the named tools may run.
Trait Implementations§
Source§impl PolicyEngine for NativePolicy
impl PolicyEngine for NativePolicy
Auto Trait Implementations§
impl Freeze for NativePolicy
impl !RefUnwindSafe for NativePolicy
impl Send for NativePolicy
impl Sync for NativePolicy
impl Unpin for NativePolicy
impl UnsafeUnpin for NativePolicy
impl !UnwindSafe for NativePolicy
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more