Struct chemfiles::Match 
                   
                       [−]
                   
               [src]
pub struct Match(_);
A Match is a set of atomic indexes matching a given selection. It can
mostly be used like a &[u64].
Methods
impl Match[src]
pub fn len(&self) -> usize[src]
Get the length of the Match.
Example
let atomic_match = Match::new(&[3, 4, 5]); assert_eq!(atomic_match.len(), 3);
pub fn new(atoms: &[u64]) -> Match[src]
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);
pub fn iter(&self) -> Iter<u64>[src]
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
impl Debug for Match[src]
impl Clone for Match[src]
fn clone(&self) -> Match[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl PartialEq for Match[src]
fn eq(&self, __arg_0: &Match) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Match) -> bool[src]
This method tests for !=.
impl Eq for Match[src]
impl Index<usize> for Match[src]
type Output = u64
The returned type after indexing.
fn index(&self, i: usize) -> &u64[src]
Performs the indexing (container[index]) operation.