Struct nthash::NtHashIterator[][src]

pub struct NtHashIterator<'a> { /* fields omitted */ }

An efficient iterator for calculating hashes for genomic sequences.

Since it implements the Iterator trait it also exposes many other useful methods. In this example we use collect to generate all hashes and put them in a Vec<u64>.

    use nthash::NtHashIterator;

    let seq = b"ACTGC";
    let iter = NtHashIterator::new(seq, 3)?;
    let hashes: Vec<u64> = iter.collect();
    assert_eq!(hashes,
               vec![0x9b1eda9a185413ce, 0x9f6acfa2235b86fc, 0xd4a29bf149877c5c]);

or, in one line:

    use nthash::NtHashIterator;

    assert_eq!(NtHashIterator::new(b"ACTGC", 3)?.collect::<Vec<u64>>(),
               vec![0x9b1eda9a185413ce, 0x9f6acfa2235b86fc, 0xd4a29bf149877c5c]);

Implementations

impl<'a> NtHashIterator<'a>[src]

pub fn new(seq: &'a [u8], k: usize) -> Result<NtHashIterator<'a>>[src]

Creates a new NtHashIterator with internal state properly initialized.

Trait Implementations

impl<'a> Debug for NtHashIterator<'a>[src]

impl<'a> ExactSizeIterator for NtHashIterator<'a>[src]

impl<'a> Iterator for NtHashIterator<'a>[src]

type Item = u64

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> RefUnwindSafe for NtHashIterator<'a>

impl<'a> Send for NtHashIterator<'a>

impl<'a> Sync for NtHashIterator<'a>

impl<'a> Unpin for NtHashIterator<'a>

impl<'a> UnwindSafe for NtHashIterator<'a>

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.