[−][src]Struct rec::Ch
Represents a match of one character.
A Ch
is composed of String
s (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 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 Clone for Ch
[src]
fn clone(&self) -> 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.
fn add(self, rhs: Rhs) -> 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::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.
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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> 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,