pub struct NodeSet { /* private fields */ }Expand description
A set of cluster node names supporting range notation like node[1-100].
§Examples
use consortium::node_set::NodeSet;
let ns = NodeSet::parse("node[1-5,10]").unwrap();
assert_eq!(ns.len(), 6);
assert!(ns.contains("node3"));
assert!(!ns.contains("node7"));Implementations§
Source§impl NodeSet
impl NodeSet
Sourcepub fn parse(pattern: &str) -> Result<Self>
pub fn parse(pattern: &str) -> Result<Self>
Parse a node set from a string like "node[1-10,15],other[001-050]".
Sourcepub fn parse_with_autostep(pattern: &str, autostep: Option<u32>) -> Result<Self>
pub fn parse_with_autostep(pattern: &str, autostep: Option<u32>) -> Result<Self>
Parse with explicit autostep setting.
Sourcepub fn update_str(&mut self, pattern: &str) -> Result<()>
pub fn update_str(&mut self, pattern: &str) -> Result<()>
Update from a string pattern.
Sourcepub fn intersection_update(&mut self, other: &NodeSet)
pub fn intersection_update(&mut self, other: &NodeSet)
Intersection update: keep only elements in both.
Sourcepub fn intersection(&self, other: &NodeSet) -> NodeSet
pub fn intersection(&self, other: &NodeSet) -> NodeSet
Return the intersection of this nodeset and another.
Sourcepub fn difference_update(&mut self, other: &NodeSet)
pub fn difference_update(&mut self, other: &NodeSet)
Difference update: remove elements of other from self.
Sourcepub fn difference(&self, other: &NodeSet) -> NodeSet
pub fn difference(&self, other: &NodeSet) -> NodeSet
Return the difference of this nodeset and another.
Sourcepub fn symmetric_difference_update(&mut self, other: &NodeSet)
pub fn symmetric_difference_update(&mut self, other: &NodeSet)
Symmetric difference update.
Sourcepub fn symmetric_difference(&self, other: &NodeSet) -> NodeSet
pub fn symmetric_difference(&self, other: &NodeSet) -> NodeSet
Return the symmetric difference of this nodeset and another.
Sourcepub fn iter(&self) -> impl Iterator<Item = String> + '_
pub fn iter(&self) -> impl Iterator<Item = String> + '_
Iterate all individual node names in sorted order.
Sourcepub fn split(&self, nbr: usize) -> Vec<NodeSet>
pub fn split(&self, nbr: usize) -> Vec<NodeSet>
Split the nodeset into nbr sub-nodesets (at most).
Sourcepub fn is_superset(&self, other: &NodeSet) -> bool
pub fn is_superset(&self, other: &NodeSet) -> bool
Check if this nodeset is a superset of another.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeSet
impl RefUnwindSafe for NodeSet
impl Send for NodeSet
impl Sync for NodeSet
impl Unpin for NodeSet
impl UnsafeUnpin for NodeSet
impl UnwindSafe for NodeSet
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