Enum Pattern

Source
pub enum Pattern {
Show 13 variants Sequence(Vec<Pattern>), Text(String), Raw(String), Or(Vec<Pattern>), Many { exp: Box<Pattern>, low: u32, high: u32, }, Digit, Letter, WordCharacter, InputStart, InputEnd, Not(Box<Pattern>), Any, Named { exp: Box<Pattern>, name: String, },
}
Expand description

A Regular Expression Pattern

Variants§

§

Sequence(Vec<Pattern>)

Sequence of patterns

§

Text(String)

Text

§

Raw(String)

Raw (unprocessed text), used internally

§

Or(Vec<Pattern>)

Alternative

§

Many

Repetition

Fields

§low: u32
§high: u32
§

Digit

Digit

§

Letter

Letter,

§

WordCharacter

Word characters

§

InputStart

Start of line/input

§

InputEnd

End of line/input

§

Not(Box<Pattern>)

Negation

§

Any

Anything

§

Named

Named group

Fields

§name: String

Implementations§

Source§

impl Pattern

Source

pub fn and_either<PL: PatternList>(self, branches: PL) -> Self

Chain an alternative

Source

pub fn and_then<T: Into<Pattern>>(self, exp: T) -> Self

Append a new pattern

Source

pub fn and_maybe<T: Into<Pattern>>(self, exp: T) -> Self

Append an optional pattern

Source

pub fn and_maybe_many<T: Into<Pattern>>(self, exp: T) -> Self

Append a pattern zero or more times

Source

pub fn and_many<T: Into<Pattern>>(self, exp: T) -> Self

Append a pattern one or more times

Source

pub fn many(self, low: u32, high: u32) -> Self

Repeat the previous pattern between low and high times

Source

pub fn times(self, n: u32) -> Self

Repeat the previous pattern n times

Source

pub fn named<S: Into<String>>(self, name: S) -> Self

name preceding pattern

Source

pub fn must_end(self) -> Self

Must reach end of input

Trait Implementations§

Source§

impl Debug for Pattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Pattern

Generate regular expression from Pattern

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<&str> for Pattern

Convert a string into a text pattern

Source§

fn from(s: &str) -> Pattern

Converts to this type from the input type.
Source§

impl From<String> for Pattern

Convert a string into a text pattern

Source§

fn from(s: String) -> Pattern

Converts to this type from the input type.
Source§

impl ToCode for Pattern

Convert Pattern to Rust code

Source§

fn to_code(&self) -> String

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.