pub struct ToolSelector { /* private fields */ }Expand description
Layers of allow and deny lists; a tool is admitted when every layer admits it. No layers admits every tool.
Implementations§
Source§impl ToolSelector
impl ToolSelector
pub fn all() -> Self
Sourcepub fn layer(allow: Option<Vec<ToolPattern>>, deny: Vec<ToolPattern>) -> Self
pub fn layer(allow: Option<Vec<ToolPattern>>, deny: Vec<ToolPattern>) -> Self
One layer. allow: None allows every tool the deny list leaves.
Sourcepub fn from_lists(allowed: &[String], disallowed: &[String]) -> Self
pub fn from_lists(allowed: &[String], disallowed: &[String]) -> Self
One layer from lists as configured, an empty allow list allowing every tool.
pub fn admits(&self, name: &str, origin: &ToolOrigin) -> bool
Sourcepub fn and(self, other: ToolSelector) -> Self
pub fn and(self, other: ToolSelector) -> Self
Both selectors’ layers: admits only what both admit.
Sourcepub fn within(&self, parent: &ToolSelector) -> bool
pub fn within(&self, parent: &ToolSelector) -> bool
Whether everything this admits, parent admits too, as far as the
patterns alone can show; false when they cannot.
Trait Implementations§
Source§impl Clone for ToolSelector
impl Clone for ToolSelector
Source§impl Debug for ToolSelector
impl Debug for ToolSelector
Source§impl Default for ToolSelector
impl Default for ToolSelector
impl Eq for ToolSelector
Source§impl PartialEq for ToolSelector
impl PartialEq for ToolSelector
impl StructuralPartialEq for ToolSelector
Auto Trait Implementations§
impl Forget for ToolSelector
impl Freeze for ToolSelector
impl Move for ToolSelector
impl RefUnwindSafe for ToolSelector
impl Send for ToolSelector
impl Sync for ToolSelector
impl Unpin for ToolSelector
impl UnsafeUnpin for ToolSelector
impl UnwindSafe for ToolSelector
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