[][src]Struct regen::Generator

pub struct Generator { /* fields omitted */ }

A generator for strings matching a regular expression

Implementations

impl Generator[src]

pub fn new(s: &str) -> Result<Self>[src]

Creates a Generator with default options.

Example

let mut gen = Generator::new("[a-z]{2}")?;

pub fn new_with_options(s: &str, opts: &GeneratorOptions) -> Result<Self>[src]

Creates a Generator with the provided options.

Example

let opts = GeneratorOptions{max_length: 5};
let mut gen = Generator::new_with_options("[a-c]*", &opts)?;

pub fn append_next(&mut self, out: &mut Vec<u8>) -> Option<usize>[src]

Appends the next generated string to the provided Vec and returns the number of elements written.

Depending on the kind of regular expression, the returned number of elements may be either a character count (for a pure unicode regex) or a byte count for a non pure unicode regex.

Example

let mut out = Vec::new();
let mut gen = Generator::new("[a-c]{2}")?;
while gen.append_next(&mut out).is_some() {
    // Process 'out'...
    out.clear();
}

Trait Implementations

impl Iterator for Generator[src]

type Item = Vec<u8>

The type of the elements being iterated over.

Auto Trait Implementations

impl !RefUnwindSafe for Generator

impl !Send for Generator

impl !Sync for Generator

impl Unpin for Generator

impl !UnwindSafe for Generator

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.