ParseStream

Struct ParseStream 

Source
pub struct ParseStream<'a, State = ()> {
    pub cursor: Cursor<'a>,
    pub state: &'a mut State,
}

Fields§

§cursor: Cursor<'a>§state: &'a mut State

Implementations§

Source§

impl<'a, State> ParseStream<'a, State>

Source

pub fn new(trees: &'a [TokenTree], state: &'a mut State) -> Self

Source

pub fn parse<T: Parser<State>>(&mut self) -> Result<T, ParseError>

Source

pub fn parse_punctuated<T: Parser<State>>( &mut self, punctuation: &Token, require_one: bool, take_all: bool, trailing: Trailing, ) -> Result<Vec<T>, ParseError>

Source

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

Source

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>

Source

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§

Source§

impl<'a, State: Debug> Debug for ParseStream<'a, State>

Source§

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

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.