[][src]Enum rec::Class

pub enum Class {
    Alpha,
    AlphaNum,
    Digit,
    Whitespace,
    Any,
    Start,
    End,
    Sign,
    NonZeroDigit,
    HexDigit,
}

An enumeration of predefined single character matches.

Variants

Alpha

Matches any alphabetic character.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::Alpha, Rec::from("[[:alpha:]]"));
AlphaNum

Matches any alphabetic or numerical digit character.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::AlphaNum, Rec::from("[[:alnum:]]"));
Digit

Matches any numerical digit character.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::Digit, Rec::from(r"\d"));
Whitespace

Matches any whitespace character.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::Whitespace, Rec::from(r"\s"));
Any

Matches any character other than a newline.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::Any, Rec::from("."));
Start

Matches with the start of the text.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::Start, Rec::from("^"));
End

Matches with the end of the text.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::End, Rec::from("$"));
Sign

Matches with the sign character of a number.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::Sign, Rec::from(r"[+\-]"));
NonZeroDigit

Matches with any digit that is not 0.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::NonZeroDigit, Rec::from(r"[1-9]"));
HexDigit

Matches with any hexidecimal digit.

Examples

use rec::{Class, prelude::*};

assert_eq!(Class::HexDigit, Rec::from("[[:xdigit:]]"));

Trait Implementations

impl Atom for Class[src]

impl Element for Class[src]

fn alternate(&self, other: &dyn Element) -> Rec[src]

Creates a Rec consisting of the alternation of self and other. Read more

fn concatenate(&self, other: &dyn Element) -> Rec[src]

Creates a Rec consisting of the concatenation of self and other.

fn is_equal(&self, other: &dyn Element) -> bool[src]

Returns if the regular expression of self is equal to that of other.

fn isolate(&self) -> String[src]

Returns the regular expression of self such that it can be concatenated. Read more

fn group(&self) -> String[src]

Returns the regular expression of self as a single Atom. Read more

impl<T: Element> PartialEq<T> for Class[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Copy for Class[src]

impl Clone for Class[src]

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

Performs copy-assignment from source. Read more

impl<Rhs: Element> Add<Rhs> for Class[src]

type Output = Rec

The resulting type after applying the + operator.

impl Add<Class> for char[src]

type Output = Rec

The resulting type after applying the + operator.

fn add(self, rhs: Class) -> Self::Output[src]

use rec::{Class, prelude::*};

assert_eq!('a' + Class::Digit, Rec::from(r"a\d"));

impl<'_> Add<Class> for &'_ str[src]

type Output = Rec

The resulting type after applying the + operator.

fn add(self, rhs: Class) -> Self::Output[src]

use rec::{Class, prelude::*};

assert_eq!("hello" + Class::Digit, Rec::from(r"hello\d"));

impl BitOr<char> for Class[src]

type Output = Ch

The resulting type after applying the | operator.

fn bitor(self, rhs: char) -> Self::Output[src]

use rec::{Class, prelude::*};

assert_eq!(Class::Alpha | '0', Rec::from("[[:alpha:]0]"));

impl BitOr<Class> for Class[src]

type Output = Ch

The resulting type after applying the | operator.

fn bitor(self, rhs: Self) -> Self::Output[src]

use rec::{Class, prelude::*};

assert_eq!(Class::Alpha | Class::Whitespace, Rec::from(r"[[:alpha:]\s]"));
use rec::{Class, prelude::*};

assert_eq!(Class::Alpha | Class::Digit, Rec::from("[[:alnum:]]"));

impl<'_> BitOr<&'_ str> for Class[src]

type Output = Rec

The resulting type after applying the | operator.

fn bitor(self, rhs: &str) -> Self::Output[src]

use rec::{Class, prelude::*};

assert_eq!(Class::Alpha | "12", Rec::from("[[:alpha:]]|12"));

impl BitOr<Rec> for Class[src]

type Output = Rec

The resulting type after applying the | operator.

impl Debug for Class[src]

Auto Trait Implementations

impl Sync for Class

impl Send for Class

impl Unpin for Class

impl RefUnwindSafe for Class

impl UnwindSafe for Class

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

impl<T> From<T> for T[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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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