[−][src]Struct rec::Ch
Represents a character that can match one or more characters.
Methods
impl<'_> Ch<'_>
[src]
pub const fn any() -> Ch<'static>
[src]
Creates a Ch
that matches any character other than a newline.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::any().into_rec(), String::from(".").into_rec());
pub const fn alpha() -> Ch<'static>
[src]
Creates a Ch
that matches any alphabetic character.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::alpha().into_rec(), String::from("[[:alpha:]]").into_rec());
pub const fn alphanum() -> Ch<'static>
[src]
Creates a Ch
that matches any alphabetic or numerical digit character.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::alphanum().into_rec(), String::from("[[:alnum:]]").into_rec());
pub const fn digit() -> Ch<'static>
[src]
Creates a Ch
that matches any numerical digit character.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::digit().into_rec(), String::from(r"\d").into_rec());
pub const fn whitespace() -> Ch<'static>
[src]
Creates a Ch
that matches any whitespace character.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::whitespace().into_rec(), String::from(r"\s").into_rec());
pub const fn start() -> Ch<'static>
[src]
Creates a Ch
that matches with the start of the text.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::start().into_rec(), String::from("^").into_rec());
pub const fn end() -> Ch<'static>
[src]
Creates a Ch
that matches with the end of the text.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::end().into_rec(), String::from("$").into_rec());
pub fn sign() -> Ch<'static>
[src]
Creates a Ch
that matches with the sign character of a number.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::sign().into_rec(), String::from(r"[+\-]").into_rec());
pub fn union(chars: &str) -> Ch
[src]
Creates a Ch
that matches with any of the given characters.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::union("abc").into_rec(), String::from("[abc]").into_rec());
-
is not interpreted as range
use rec::{Ch, Element}; assert_eq!(Ch::union("a-c").into_rec(), String::from(r"[a\-c]").into_rec());
pub fn range(first: char, last: char) -> Ch<'static>
[src]
Creates a Ch
that matches with any character between or including the given characters.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::range('a', 'c').into_rec(), String::from(r"[a-c]").into_rec());
pub fn digitnz() -> Ch<'static>
[src]
Creates a Ch
that matches with any digit that is not 0
.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::digitnz().into_rec(), String::from(r"[1-9]").into_rec());
pub fn hexdigit() -> Ch<'static>
[src]
Creates a Ch
that matches with any hexidecimal digit.
Examples
use rec::{Ch, Element}; assert_eq!(Ch::hexdigit().into_rec(), String::from("[[:xdigit:]]").into_rec());
Trait Implementations
impl<'_> Element for Ch<'_>
[src]
fn into_rec(self) -> Rec
[src]
fn unionable_value(&self) -> Option<String>
[src]
fn group(self) -> Rec where
Self: Sized,
[src]
Self: Sized,
Converts self
into a Rec
that is grouped.
impl<'a> Debug for Ch<'a>
[src]
impl<'_, '_> Add<Ch<'_>> for &'_ str
[src]
type Output = Rec
The resulting type after applying the +
operator.
fn add(self, rhs: Ch) -> Rec
[src]
impl<Rhs: Element, '_> Add<Rhs> for Ch<'_>
[src]
type Output = Rec
The resulting type after applying the +
operator.
fn add(self, rhs: Rhs) -> Rec
[src]
impl<'a> Not for Ch<'a>
[src]
type Output = Ch<'a>
The resulting type after applying the !
operator.
fn not(self) -> Self::Output
[src]
impl<Rhs: Element, '_> BitOr<Rhs> for Ch<'_>
[src]
use rec::{Ch, Element}; assert_eq!(Ch::union("ab") | Ch::union("c"), String::from("[abc]").into_rec());
use rec::{Ch, Element}; assert_eq!(Ch::alpha() | Ch::whitespace(), String::from(r"[[:alpha:]\s]").into_rec());
use rec::{Ch, Element}; assert_eq!(Ch::alpha() | "0", String::from("[[:alpha:]0]").into_rec());
Make sure alternation with multiple characters is not combined into 1 union.
use rec::{Ch, Element}; assert_eq!(Ch::alpha() | "12", String::from("(?:[[:alpha:]]|12)").into_rec());
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,