Struct chemfiles::Match [] [src]

pub struct Match(_);

A Match is a set of atomic indexes matching a given selection. It should be used like a &[u64].

Methods

impl Match
[src]

Get the length of the Match.

Example

let atomic_match = Match::new(&[3, 4, 5]);
assert_eq!(atomic_match.len(), 3);

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);

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]

Formats the value using the given formatter.

impl Clone for Match
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Match
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Match
[src]

impl Index<usize> for Match
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

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

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more