Struct syntax_rs::parse::ParseStream
source · [−]pub struct ParseStream<'a> { /* private fields */ }
Implementations
sourceimpl<'a> ParseStream<'a>
impl<'a> ParseStream<'a>
pub fn new(slice: &'a [char]) -> ParseStream<'a>
pub fn empty() -> ParseStream<'a>
pub fn snapshot(&self) -> Snapshot
pub fn since(&self, snapshot: Snapshot) -> Span
pub fn parse<P: Parse>(&mut self) -> Result<P>
sourcepub fn exhaustive_parse<P: Parse>(&mut self) -> Result<Vec<P>>
pub fn exhaustive_parse<P: Parse>(&mut self) -> Result<Vec<P>>
Parse until the cursor is empty or there are only whitespaces left.
pub fn cur(&mut self) -> &mut Cursor<'a>
pub fn is_empty(&self) -> bool
pub fn is_only_whitespaces(&self) -> bool
pub fn skip_all(&mut self, pred: impl FnMut(char) -> bool) -> bool
sourcepub fn try_parse<R>(
&mut self,
parse_fn: impl FnOnce(&mut ParseStream<'a>) -> Result<R>
) -> Result<R>
pub fn try_parse<R>(
&mut self,
parse_fn: impl FnOnce(&mut ParseStream<'a>) -> Result<R>
) -> Result<R>
Tries to parse something using the parse_fn
parameter.
On failure; the cursor is reset to it’s original value.
NOTE: This function is generally much more expensive than just doing a simple check before parsing.
Auto Trait Implementations
impl<'a> RefUnwindSafe for ParseStream<'a>
impl<'a> Send for ParseStream<'a>
impl<'a> Sync for ParseStream<'a>
impl<'a> Unpin for ParseStream<'a>
impl<'a> UnwindSafe for ParseStream<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more