[][src]Struct ptero::text::CoverTextWordIterator

pub struct CoverTextWordIterator { /* fields omitted */ }

Cover text iterator which traverses the text word by word. It also enables the user to peek the word without forwarding the iterator.

Implementations

impl CoverTextWordIterator[src]

pub fn new(cover_text: &str) -> Self[src]

pub fn peek(&self) -> Option<String>[src]

Examples

Returns the next word without forwarding the iterator

use ptero::text::CoverTextWordIterator;

let text = "a b c d e;";
let iter: CoverTextWordIterator = CoverTextWordIterator::new(&text);

assert_eq!(iter.peek(), Some("a".to_owned()));
assert_eq!(iter.peek(), Some("a".to_owned()));

Trait Implementations

impl Debug for CoverTextWordIterator[src]

impl Iterator for CoverTextWordIterator[src]

type Item = String

The type of the elements being iterated over.

pub fn next(&mut self) -> Option<Self::Item>[src]

Examples

Returns the next word

use ptero::text::CoverTextWordIterator;

let text = "a b c";
let mut iter: CoverTextWordIterator = CoverTextWordIterator::new(&text);

assert_eq!(iter.next(), Some("a".to_owned()));
assert_eq!(iter.next(), Some("b".to_owned()));

Returns None when iterator has traversed all the words and does not repeat

use ptero::text::CoverTextWordIterator;

let text = "a b c";
let mut iter: CoverTextWordIterator = CoverTextWordIterator::new(&text);

assert_eq!(iter.next(), Some("a".to_owned()));
assert_eq!(iter.next(), Some("b".to_owned()));
assert_eq!(iter.next(), Some("c".to_owned()));
assert_eq!(iter.next(), None);
assert_eq!(iter.next(), None);

Auto Trait Implementations

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<I> IteratorRandom for I where
    I: Iterator
[src]

impl<S, T> ProgressIterator for T where
    T: Iterator<Item = S>, 
[src]

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,