[][src]Struct rec::Ch

pub struct Ch { /* fields omitted */ }

Represents a match of one character.

A Ch is composed of Strings (AKA parts) combined with an [Operation].

Methods

impl Ch[src]

pub fn either(chars: &str) -> Self[src]

Creates a Ch that matches with any of the given characters.

Examples

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

assert_eq!(Ch::either("abc"), Rec::from("[abc]"));

- is not interpreted as range

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

assert_eq!(Ch::either("a-c"), Rec::from(r"[a\-c]"));

pub fn range(start: char, end: char) -> Self[src]

Creates a Ch that is a range between and including start and end.

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

assert_eq!(Ch::range('a', 'c'), Rec::from("[a-c]"));

Trait Implementations

impl Atom for Ch[src]

impl Element for Ch[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 Ch[src]

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

This method tests for !=.

impl Clone for Ch[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 Ch[src]

type Output = Rec

The resulting type after applying the + operator.

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

type Output = Rec

The resulting type after applying the + operator.

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

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

assert_eq!("25" + Ch::range('0', '5'), Rec::from("25[0-5]"));

impl BitOr<Ch> for Ch[src]

type Output = Self

The resulting type after applying the | operator.

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

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

assert_eq!(Ch::either("ab") | Ch::either("cd"), Rec::from("[abcd]"));
use rec::{Ch, prelude::*};

assert_eq!(Ch::range('a', 'c') | Ch::either("xyz"), Rec::from("[a-cxyz]"));

impl BitOr<char> for Ch[src]

type Output = Self

The resulting type after applying the | operator.

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

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

assert_eq!(Ch::either("ab") | 'c', Rec::from("[abc]"));

impl BitOr<Rec> for Ch[src]

type Output = Rec

The resulting type after applying the | operator.

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

type Output = Rec

The resulting type after applying the | operator.

impl BitOr<Ch> for Rec[src]

type Output = Self

The resulting type after applying the | operator.

impl Debug for Ch[src]

Auto Trait Implementations

impl Send for Ch

impl Unpin for Ch

impl Sync for Ch

impl UnwindSafe for Ch

impl RefUnwindSafe for Ch

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<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]