pub enum NameFilter {
PassAll,
AllowList(HashSet<String>),
DenyList(HashSet<String>),
}Expand description
A name-based allow/deny filter.
Variants§
PassAll
No filtering – everything passes.
AllowList(HashSet<String>)
Only items in this set are allowed.
DenyList(HashSet<String>)
Items in this set are denied.
Implementations§
Source§impl NameFilter
impl NameFilter
Sourcepub fn allows(&self, name: &str) -> bool
pub fn allows(&self, name: &str) -> bool
Check if a capability name is allowed by this filter.
§Examples
use std::collections::HashSet;
use mcp_proxy::config::NameFilter;
let filter = NameFilter::DenyList(["delete".to_string()].into());
assert!(filter.allows("read"));
assert!(!filter.allows("delete"));
let filter = NameFilter::AllowList(["read".to_string()].into());
assert!(filter.allows("read"));
assert!(!filter.allows("write"));
assert!(NameFilter::PassAll.allows("anything"));Trait Implementations§
Source§impl Clone for NameFilter
impl Clone for NameFilter
Source§fn clone(&self) -> NameFilter
fn clone(&self) -> NameFilter
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 NameFilter
impl RefUnwindSafe for NameFilter
impl Send for NameFilter
impl Sync for NameFilter
impl Unpin for NameFilter
impl UnsafeUnpin for NameFilter
impl UnwindSafe for NameFilter
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