[][src]Struct chemfiles::Match

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 Eq for Match[src]

impl PartialEq<Match> for Match[src]

impl<'a> IntoIterator for &'a Match[src]

type Item = &'a u64

The type of the elements being iterated over.

type IntoIter = Iter<'a, u64>

Which kind of iterator are we turning this into?

impl Clone for Match[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Match[src]

impl Index<usize> for Match[src]

type Output = u64

The returned type after indexing.

Auto Trait Implementations

impl Send for Match

impl Sync for Match

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]