[][src]Struct rec::Pattern

pub struct Pattern { /* fields omitted */ }

Represents a regular expression to be matched against a target.

Methods

impl Pattern
[src]

pub fn define<T: Element>(element: T) -> Self
[src]

Creates a Pattern.

This is only safe to use with Elements that are known prior to runtime.

Panics

Panics if element converts into a Rec with an invalid regular expression.

pub fn load<T: Element>(element: T) -> Result<Self, Error>
[src]

Attempts to create a Pattern.

This is intended to be used with Elements that are not known prior to runtime.

Errors

Returns regex::Error if attempt is unsuccesful.

pub fn tokenize<'t>(&self, target: &'t str) -> Tokens<'t>
[src]

Produces Tokens that match self with given target.

Important traits for TokensIter<'_, 't>
pub fn tokenize_iter<'r, 't>(&'r self, target: &'t str) -> TokensIter<'r, 't>
[src]

Produces an Iterator of Tokens that match self with given target.

After each Tokens is produced, the next one is searched from the target after the current match.

pub fn locate(&self, target: &str) -> Option<Location>
[src]

Produces Location of the match.

If no match is found, returns None.

Important traits for Locations<'_, '_>
pub fn locate_iter<'r, 't>(&'r self, target: &'t str) -> Locations<'r, 't>
[src]

Produces Locations that match self with given target.

After each Location is produced, the next one is searched from the target after the current match.

Trait Implementations

impl Clone for Pattern
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Pattern
[src]

Auto Trait Implementations

impl Send for Pattern

impl Sync for Pattern

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T
[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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