Struct Parser

pub struct Parser { /* private fields */ }

A regular expression parser.

This parses a string representation of a regular expression into an abstract syntax tree. The size of the tree is proportional to the length of the regular expression pattern.

A Parser can be configured in more detail via a ParserBuilder.

Implementations

impl Parser

fn new() -> Parser

Create a new parser with a default configuration.

The parser can be run with either the parse or parse_with_comments methods. The parse methods return an abstract syntax tree.

To set configuration options on the parser, use ParserBuilder.

fn parse(&mut self, pattern: &str) -> Result<Ast, Error>

Parse the regular expression into an abstract syntax tree.

fn parse_with_comments(&mut self, pattern: &str) -> Result<WithComments, Error>

Parse the regular expression and return an abstract syntax tree with all of the comments found in the pattern.

Trait Implementations

impl Clone for Parser

fn clone(&self) -> Self

impl Debug for Parser

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

Auto Trait Implementations

impl !Freeze for Parser

impl !RefUnwindSafe for Parser

impl !Sync for Parser

impl Send for Parser

impl Unpin for Parser

impl UnsafeUnpin for Parser

impl UnwindSafe for Parser

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Parser

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T, U> Into<U> for Parser 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 Parser where U: Into<T>,

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

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

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