pub struct NodeRestrictionList { /* private fields */ }Expand description
A list of node restrictions to apply.
All restrictions must pass for a router to be accepted. This allows combining multiple filtering criteria (e.g., flags + bandwidth + country).
§Example
use vanguards_rs::node_selection::{FlagsRestriction, NodeRestrictionList};
let flags = FlagsRestriction::new(
vec!["Fast".to_string()],
vec!["BadExit".to_string()],
);
let restrictions = NodeRestrictionList::new(vec![Box::new(flags)]);§See Also
NodeRestriction- Trait for individual restrictionsFlagsRestriction- Built-in flag-based restriction
Implementations§
Source§impl NodeRestrictionList
impl NodeRestrictionList
Sourcepub fn new(restrictions: Vec<Box<dyn NodeRestriction>>) -> Self
pub fn new(restrictions: Vec<Box<dyn NodeRestriction>>) -> Self
Creates a new restriction list.
Sourcepub fn r_is_ok(&self, router: &RouterStatusEntry) -> bool
pub fn r_is_ok(&self, router: &RouterStatusEntry) -> bool
Returns true if the router passes all restrictions.
Auto Trait Implementations§
impl Freeze for NodeRestrictionList
impl !RefUnwindSafe for NodeRestrictionList
impl Send for NodeRestrictionList
impl Sync for NodeRestrictionList
impl Unpin for NodeRestrictionList
impl !UnwindSafe for NodeRestrictionList
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