pub struct Match { /* private fields */ }
Expand description
A Match
is a set of atomic indexes matching a given selection. It can
mostly be used like a &[usize]
.
Implementations§
source§impl Match
impl Match
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the length of the Match.
Example
let atomic_match = Match::new(&[3, 4, 5]);
assert_eq!(atomic_match.len(), 3);
sourcepub fn new(atoms: &[usize]) -> Match
pub fn new(atoms: &[usize]) -> Match
Create a new match containing the atoms in the atoms
slice.
Panics
If the slice contains more than 4 elements, which is the maximal size of a match.
Example
let atomic_match = Match::new(&[3, 4, 5]);
assert_eq!(atomic_match.len(), 3);
assert_eq!(atomic_match[0], 3);
assert_eq!(atomic_match[1], 4);
assert_eq!(atomic_match[2], 5);
sourcepub fn iter(&self) -> Iter<'_, usize>
pub fn iter(&self) -> Iter<'_, usize>
Iterate over the atomic indexes in the match.
Example
let atomic_match = Match::new(&[3, 4, 5]);
let mut iter = atomic_match.iter();
assert_eq!(iter.next(), Some(&3));
assert_eq!(iter.next(), Some(&4));
assert_eq!(iter.next(), Some(&5));
assert_eq!(iter.next(), None);
Trait Implementations§
source§impl<'a> IntoIterator for &'a Match
impl<'a> IntoIterator for &'a Match
source§impl PartialEq for Match
impl PartialEq for Match
impl Eq for Match
impl StructuralEq for Match
impl StructuralPartialEq for Match
Auto Trait Implementations§
impl RefUnwindSafe for Match
impl Send for Match
impl Sync for Match
impl Unpin for Match
impl UnwindSafe for Match
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