pub struct KindFilter { /* private fields */ }Expand description
Filters adapters by their kind (pure matcher, no include/exclude semantics).
This filter matches adapters whose kind is contained in the specified set.
Use with FilterChain to apply include/exclude logic.
§Examples
use ddns_a::network::filter::{KindFilter, AdapterFilter};
use ddns_a::network::{AdapterSnapshot, AdapterKind};
// Match wireless and ethernet adapters
let filter = KindFilter::new([AdapterKind::Wireless, AdapterKind::Ethernet]);
let eth = AdapterSnapshot::new("eth0", AdapterKind::Ethernet, vec![], vec![]);
let loopback = AdapterSnapshot::new("lo", AdapterKind::Loopback, vec![], vec![]);
assert!(filter.matches(ð));
assert!(!filter.matches(&loopback));Implementations§
Source§impl KindFilter
impl KindFilter
Sourcepub fn new(kinds: impl IntoIterator<Item = AdapterKind>) -> Self
pub fn new(kinds: impl IntoIterator<Item = AdapterKind>) -> Self
Creates a kind filter matching any of the specified kinds.
Sourcepub fn kinds(&self) -> &HashSet<AdapterKind>
pub fn kinds(&self) -> &HashSet<AdapterKind>
Returns a reference to the set of kinds.
Trait Implementations§
Source§impl AdapterFilter for KindFilter
impl AdapterFilter for KindFilter
Source§fn matches(&self, adapter: &AdapterSnapshot) -> bool
fn matches(&self, adapter: &AdapterSnapshot) -> bool
Returns
true if the adapter should be included, false to filter it out.Source§impl Clone for KindFilter
impl Clone for KindFilter
Source§fn clone(&self) -> KindFilter
fn clone(&self) -> KindFilter
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 KindFilter
impl RefUnwindSafe for KindFilter
impl Send for KindFilter
impl Sync for KindFilter
impl Unpin for KindFilter
impl UnwindSafe for KindFilter
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