Enum Ast

enum Ast

An abstract syntax tree for a single regular expression.

An Ast's fmt::Display implementation uses constant stack space and heap space proportional to the size of the Ast.

This type defines its own destructor that uses constant stack space and heap space proportional to the size of the Ast.

Variants

Empty(alloc::boxed::Box<Span>)

An empty regex that matches everything.

Flags(alloc::boxed::Box<SetFlags>)

A set of flags, e.g., (?is).

Literal(alloc::boxed::Box<Literal>)

A single character literal, which includes escape sequences.

Dot(alloc::boxed::Box<Span>)

The "any character" class.

Assertion(alloc::boxed::Box<Assertion>)

A single zero-width assertion.

ClassUnicode(alloc::boxed::Box<ClassUnicode>)

A single Unicode character class, e.g., \pL or \p{Greek}.

ClassPerl(alloc::boxed::Box<ClassPerl>)

A single perl character class, e.g., \d or \W.

ClassBracketed(alloc::boxed::Box<ClassBracketed>)

A single bracketed character class set, which may contain zero or more character ranges and/or zero or more nested classes. e.g., [a-zA-Z\pL].

Repetition(alloc::boxed::Box<Repetition>)

A repetition operator applied to an arbitrary regular expression.

Group(alloc::boxed::Box<Group>)

A grouped regular expression.

Alternation(alloc::boxed::Box<Alternation>)

An alternation of regular expressions.

Concat(alloc::boxed::Box<Concat>)

A concatenation of regular expressions.

Implementations

impl Ast

fn empty(span: Span) -> Ast

Create an "empty" AST item.

fn flags(e: SetFlags) -> Ast

Create a "flags" AST item.

fn literal(e: Literal) -> Ast

Create a "literal" AST item.

fn dot(span: Span) -> Ast

Create a "dot" AST item.

fn assertion(e: Assertion) -> Ast

Create a "assertion" AST item.

fn class_unicode(e: ClassUnicode) -> Ast

Create a "Unicode class" AST item.

fn class_perl(e: ClassPerl) -> Ast

Create a "Perl class" AST item.

fn class_bracketed(e: ClassBracketed) -> Ast

Create a "bracketed class" AST item.

fn repetition(e: Repetition) -> Ast

Create a "repetition" AST item.

fn group(e: Group) -> Ast

Create a "group" AST item.

fn alternation(e: Alternation) -> Ast

Create a "alternation" AST item.

fn concat(e: Concat) -> Ast

Create a "concat" AST item.

fn span(self: &Self) -> &Span

Return the span of this abstract syntax tree.

fn is_empty(self: &Self) -> bool

Return true if and only if this Ast is empty.

impl Clone for Ast

fn clone(self: &Self) -> Ast

impl Debug for Ast

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

impl Display for Ast

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

impl Drop for Ast

fn drop(self: &mut Self)

impl Eq for Ast

impl Freeze for Ast

impl PartialEq for Ast

fn eq(self: &Self, other: &Ast) -> bool

impl RefUnwindSafe for Ast

impl Send for Ast

impl StructuralPartialEq for Ast

impl Sync for Ast

impl Unpin for Ast

impl UnsafeUnpin for Ast

impl UnwindSafe for Ast

impl<T> Any for Ast

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Ast

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Ast

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

impl<T> CloneToUninit for Ast

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

impl<T> From for Ast

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Ast

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for Ast

fn to_string(self: &Self) -> String

impl<T, U> Into for Ast

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Ast

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

impl<T, U> TryInto for Ast

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