Enum Ast

pub 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(Box<Span>)

An empty regex that matches everything.

Flags(Box<SetFlags>)

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

Literal(Box<Literal>)

A single character literal, which includes escape sequences.

Dot(Box<Span>)

The "any character" class.

Assertion(Box<Assertion>)

A single zero-width assertion.

ClassUnicode(Box<ClassUnicode>)

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

ClassPerl(Box<ClassPerl>)

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

ClassBracketed(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(Box<Repetition>)

A repetition operator applied to an arbitrary regular expression.

Group(Box<Group>)

A grouped regular expression.

Alternation(Box<Alternation>)

An alternation of regular expressions.

Concat(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) -> &Span

Return the span of this abstract syntax tree.

fn is_empty(&self) -> bool

Return true if and only if this Ast is empty.

Trait Implementations

impl Clone for Ast

fn clone(&self) -> Self

impl Debug for Ast

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

impl Display for Ast

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

impl Drop for Ast

fn drop(&mut self)

impl Eq for Ast

impl PartialEq for Ast

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

impl StructuralPartialEq for Ast

Auto Trait Implementations

impl Freeze for Ast

impl RefUnwindSafe for Ast

impl Send for Ast

impl Sync for Ast

impl Unpin for Ast

impl UnsafeUnpin for Ast

impl UnwindSafe for Ast

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Ast

fn from(t: T) -> T

Returns the argument unchanged.

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn to_string(&self) -> String

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

fn into(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<U> for Ast where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

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