Enum Regex

Source
pub enum Regex<B: Builder> {
    EmptySet,
    EmptyString,
    Symbol(B::Symbol),
    Concat(Box<Self>, Box<Self>),
    Closure(Box<Self>),
    Or(Box<Self>, Box<Self>),
    And(Box<Self>, Box<Self>),
    Complement(Box<Self>),
}
Expand description

Data type describing regular expressions.

Variants§

§

EmptySet

The empty set

§

EmptyString

The empty string ε

§

Symbol(B::Symbol)

A symbol s

§

Concat(Box<Self>, Box<Self>)

Concatenation R S

§

Closure(Box<Self>)

Closure R*

§

Or(Box<Self>, Box<Self>)

Disjunction R | S

§

And(Box<Self>, Box<Self>)

Conjunction R & R

§

Complement(Box<Self>)

Complement ¬R

Implementations§

Source§

impl<S: Alphabet> Regex<ApproximatelySimilarCanonical<S>>

Source

pub fn to_automaton(&self) -> FiniteAutomaton<S>

Returns a finite automaton for this regular expression.

Source§

impl<B: Builder> Regex<B>

Source

pub fn empty_set() -> Self

Source

pub fn empty_string() -> Self

Source

pub fn symbol(value: B::Symbol) -> Self

Source

pub fn closure(inner: Self) -> Self

Source

pub fn concat(left: Self, right: Self) -> Self

Source

pub fn or(left: Self, right: Self) -> Self

Source

pub fn and(left: Self, right: Self) -> Self

Source

pub fn complement(inner: Self) -> Self

Source§

impl<B: Builder> Regex<B>

Source

pub fn rebuild<X: Builder<Symbol = B::Symbol>>(&self) -> Regex<X>

Rebuild this regular expression using a different builder over the same symbol type.

Source§

impl<B: Builder> Regex<B>

Source

pub fn derive_iter<I>(&self, symbols: impl IntoIterator<Item = I>) -> Regex<B>
where I: Borrow<B::Symbol>,

Returns the derivative of this regular expression w.r.t. the given symbols.

Source

pub fn derive(&self, symbol: &B::Symbol) -> Regex<B>

Returns the derivative of this regular expression w.r.t. to the given symbol.

Source

pub fn matches<I>(&self, symbols: impl IntoIterator<Item = I>) -> bool
where I: Borrow<B::Symbol>,

Returns whether the string of symbols is in the language of this regular expression.

Source§

impl<B: Builder> Regex<B>

Source

pub fn is_nullable(&self) -> bool

Returns whether the empty string is in the language of this regular expression.

Source

pub fn nullable(&self) -> Regex<B>

Returns empty string if this regular expression is nullable, otherwise returns empty set.

Trait Implementations§

Source§

impl<B: Builder> Add for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<B: Builder> BitAnd for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl<B: Builder> BitOr for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl<B: Builder> Clone for Regex<B>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug + Builder> Debug for Regex<B>
where B::Symbol: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: Builder> Display for Regex<B>
where B::Symbol: Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: Hash + Builder> Hash for Regex<B>
where B::Symbol: Hash,

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<B: Builder> Not for Regex<B>

Source§

type Output = Regex<B>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<B: PartialEq + Builder> PartialEq for Regex<B>
where B::Symbol: PartialEq,

Source§

fn eq(&self, other: &Regex<B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<B: Eq + Builder> Eq for Regex<B>
where B::Symbol: Eq,

Source§

impl<B: Builder> StructuralPartialEq for Regex<B>

Auto Trait Implementations§

§

impl<B> Freeze for Regex<B>
where <B as Builder>::Symbol: Freeze,

§

impl<B> RefUnwindSafe for Regex<B>
where <B as Builder>::Symbol: RefUnwindSafe,

§

impl<B> Send for Regex<B>
where <B as Builder>::Symbol: Send,

§

impl<B> Sync for Regex<B>
where <B as Builder>::Symbol: Sync,

§

impl<B> Unpin for Regex<B>
where <B as Builder>::Symbol: Unpin,

§

impl<B> UnwindSafe for Regex<B>
where <B as Builder>::Symbol: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<S, T> IntoClosure<S> for T
where S: Alphabet, T: IntoClosure<ApproximatelySimilarCanonical<S>>,

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.