pub struct ParseStream<'a, State = ()> {
pub cursor: Cursor<'a>,
pub state: &'a mut State,
}Fields§
§cursor: Cursor<'a>§state: &'a mut StateImplementations§
Source§impl<'a, State> ParseStream<'a, State>
impl<'a, State> ParseStream<'a, State>
pub fn new(trees: &'a [TokenTree], state: &'a mut State) -> Self
pub fn parse<T: Parser<State>>(&mut self) -> Result<T, ParseError>
pub fn parse_punctuated<T: Parser<State>>( &mut self, punctuation: &Token, require_one: bool, take_all: bool, trailing: Trailing, ) -> Result<Vec<T>, ParseError>
Sourcepub fn parse_block<T: Parser<State>>(
&mut self,
delimiter: Block,
) -> Result<T, ParseError>
pub fn parse_block<T: Parser<State>>( &mut self, delimiter: Block, ) -> Result<T, ParseError>
If the next item in the cursor is the type of block, turn the block into a parse stream
pub fn parse_block_punctuated<T: Parser<State>>( &mut self, delimiter: Block, punctuation: &Token, require_one: bool, take_all: bool, trailing: Trailing, ) -> Result<Vec<T>, ParseError>
Sourcepub fn new_block_parse_stream<'b>(
&'b mut self,
delimiter: Block,
) -> Result<ParseStream<'b, State>, ParseError>
pub fn new_block_parse_stream<'b>( &'b mut self, delimiter: Block, ) -> Result<ParseStream<'b, State>, ParseError>
Turns the next block into a new parse stream. Useful since will only parse inside the block and below.
Unlike using Cursor which moves in and out of blocks.
After parsing a successful block. You may need to move your cursor end
Trait Implementations§
Auto Trait Implementations§
impl<'a, State> Freeze for ParseStream<'a, State>
impl<'a, State> RefUnwindSafe for ParseStream<'a, State>where
State: RefUnwindSafe,
impl<'a, State> Send for ParseStream<'a, State>where
State: Send,
impl<'a, State> Sync for ParseStream<'a, State>where
State: Sync,
impl<'a, State> Unpin for ParseStream<'a, State>
impl<'a, State = ()> !UnwindSafe for ParseStream<'a, State>
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