pub struct Parser<C> { /* private fields */ }Expand description
Primary library interface to RSX Parser
Allows customization through ParserConfig.
Support recovery after parsing invalid token.
Implementations§
Source§impl<C: CustomNode + Debug> Parser<C>
impl<C: CustomNode + Debug> Parser<C>
Sourcepub fn new(config: ParserConfig<C>) -> Self
pub fn new(config: ParserConfig<C>) -> Self
Create a new parser with the given ParserConfig.
Sourcepub fn parse_simple(&self, v: impl Into<TokenStream>) -> Result<Vec<Node<C>>>
pub fn parse_simple(&self, v: impl Into<TokenStream>) -> Result<Vec<Node<C>>>
Parse the given proc-macro2::TokenStream or
proc-macro::TokenStream into a Node tree.
Sourcepub fn parse_recoverable(
&self,
v: impl Into<TokenStream>,
) -> ParsingResult<Vec<Node<C>>>
pub fn parse_recoverable( &self, v: impl Into<TokenStream>, ) -> ParsingResult<Vec<Node<C>>>
Advance version of parse_simple that returns array of errors in case
of partial parsing.
Sourcepub fn parse_syn_stream(
&self,
input: ParseStream<'_>,
) -> ParsingResult<Vec<Node<C>>>
pub fn parse_syn_stream( &self, input: ParseStream<'_>, ) -> ParsingResult<Vec<Node<C>>>
Parse a given ParseStream.
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Parser<C>
impl<C> !RefUnwindSafe for Parser<C>
impl<C> !Send for Parser<C>
impl<C> !Sync for Parser<C>
impl<C> Unpin for Parser<C>where
C: Unpin,
impl<C> !UnwindSafe for Parser<C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more