[−][src]Enum rec::Ch
Represents a match of one character.
Variants
AnyOf(&'static str)
Matches any of the chars in the given &str.
Examples
use rec::{Ch, prelude::*}; assert_eq!(Ch::AnyOf("abc"), Rec::from("[abc]"));
-
is not interpreted as range
use rec::{Ch, prelude::*}; assert_eq!(Ch::AnyOf("a-c"), Rec::from(r"[a\-c]"));
Union(Vec<String>)
Matches any of the given parts.
Range(char, char)
Matches any character between (inclusive) the 2 given chars.
Methods
impl Ch
[src]
pub fn spread<T: Into<char>>(start: T, end: T) -> Self
[src]
use rec::{Ch, prelude::*}; assert_eq!(Ch::spread(32, 45), Ch::Range(char::from(32), char::from(45)));
pub fn value<T: Into<char>>(value: T) -> Self
[src]
Creates a Ch
that matches the character with the given numeric value.
use rec::{Ch, prelude::*}; assert_eq!(Ch::value(0x20), Ch::AnyOf(" "));
Trait Implementations
impl Atom for Ch
[src]
fn to_part(&self) -> String
[src]
use rec::{Ch, prelude::*}; assert_eq!(Ch::Range('a', 'c'), Rec::from("[a-c]"));
impl Element for Ch
[src]
fn to_regex(&self) -> String
[src]
fn is_atom(&self) -> bool
[src]
fn alternate(&self, other: &dyn Element) -> Rec
[src]
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]
impl<T: Element> PartialEq<T> for Ch
[src]
fn eq(&self, other: &T) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<Rhs: Element> Add<Rhs> for Ch
[src]
type Output = Rec
The resulting type after applying the +
operator.
fn add(self, rhs: Rhs) -> Self::Output
[src]
impl Add<Ch> for char
[src]
type Output = Rec
The resulting type after applying the +
operator.
fn add(self, rhs: Ch) -> Self::Output
[src]
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::AnyOf("ab") | Ch::AnyOf("cd"), Rec::from("[abcd]"));
use rec::{Ch, prelude::*}; assert_eq!(Ch::Range('a', 'c') | Ch::AnyOf("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::AnyOf("ab") | 'c', Rec::from("[abc]"));
impl BitOr<Rec> for Ch
[src]
type Output = Rec
The resulting type after applying the |
operator.
fn bitor(self, rhs: Rec) -> Self::Output
[src]
impl<'_> BitOr<&'_ str> for Ch
[src]
type Output = Rec
The resulting type after applying the |
operator.
fn bitor(self, rhs: &str) -> Self::Output
[src]
impl BitOr<Ch> for Rec
[src]
type Output = Self
The resulting type after applying the |
operator.
fn bitor(self, rhs: Ch) -> Self::Output
[src]
impl Debug for Ch
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,