Struct Parser
pub struct Parser { /* private fields */ }
A convenience parser for regular expressions.
This parser takes as input a regular expression pattern string (the "concrete syntax") and returns a high-level intermediate representation (the HIR) suitable for most types of analysis. In particular, this parser hides the intermediate state of producing an AST (the "abstract syntax"). The AST is itself far more complex than the HIR, so this parser serves as a convenience for never having to deal with it at all.
If callers have more fine grained use cases that need an AST, then please
see the ast::parse module.
A Parser can be configured in more detail via a ParserBuilder.
Implementations
impl Parser
fn new() -> ParserCreate a new parser with a default configuration.
The parser can be run with
parsemethod. The parse method returns a high level intermediate representation of the given regular expression.To set configuration options on the parser, use
ParserBuilder.fn parse(&mut self, pattern: &str) -> Result<Hir, Error>Parse the regular expression into a high level intermediate representation.
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) -> TReturns the argument unchanged.
impl<T> ToOwned for Parser
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Parser
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses 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>