Struct strizer::StringTokenizer[][src]

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

StringTokenizer defines the structure for the tokenization of strings.

Examples

use strizer::StringTokenizer;

let token_count = StringTokenizer::new("hello world", &[]).count();
assert_eq!(token_count, 2);

Implementations

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

pub fn new(input: &'a str, identifiers: &'a [char]) -> Self[src]

Creates a new StringTokenizer with a given string input. The different offsets and data used while iterating is also initialized.

Examples

use std::io::Cursor;
use strizer::{StringTokenizer, Token, TokenKind};

let tokenizer = StringTokenizer::new("abracadabra", &['a']);

let a_count = tokenizer
  .filter(|(token, _, slice)| token.is_character() && slice == &"a")
  .count();

assert_eq!(a_count, 5);

Trait Implementations

impl<'a> Clone for StringTokenizer<'a>[src]

impl<'a> Copy for StringTokenizer<'a>[src]

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

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

StringTokenizer implementation for Iterator.

type Item = (Token, Span, &'a str)

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> RefUnwindSafe for StringTokenizer<'a>

impl<'a> Send for StringTokenizer<'a>

impl<'a> Sync for StringTokenizer<'a>

impl<'a> Unpin for StringTokenizer<'a>

impl<'a> UnwindSafe for StringTokenizer<'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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.