[−][src]Struct wast_parser::parser::Cursor
An immutable cursor into a list of tokens.
This cursor cannot be mutated but can be used to parse more tokens in a list
of tokens. Cursors are created from the Parser::step method. This is a
very low-level parsing structure and you likely won't use it much.
Methods
impl<'a> Cursor<'a>[src]
pub fn cur_span(&self) -> Span[src]
Returns the span of the current token
pub fn error(&self, msg: impl Display) -> Error[src]
Same as Parser::error, but works with the current token in this
Cursor instead.
pub fn lparen(self) -> Option<Self>[src]
Attempts to advance this cursor if the current token is a (.
If the current token is (, returns a new Cursor pointing at the
rest of the tokens in the stream. Otherwise returns None.
pub fn rparen(self) -> Option<Self>[src]
Attempts to advance this cursor if the current token is a ).
If the current token is ), returns a new Cursor pointing at the
rest of the tokens in the stream. Otherwise returns None.
pub fn id(self) -> Option<(&'a str, Self)>[src]
Attempts to advance this cursor if the current token is a
Token::Id
If the current token is Id, returns the identifier minus the leading
$ character as well as a new Cursor pointing at the rest of the
tokens in the stream. Otherwise returns None.
pub fn keyword(self) -> Option<(&'a str, Self)>[src]
Attempts to advance this cursor if the current token is a
Token::Keyword
If the current token is Keyword, returns the keyword as well as a new
Cursor pointing at the rest of the tokens in the stream. Otherwise
returns None.
pub fn integer(self) -> Option<(&'a Integer<'a>, Self)>[src]
Attempts to advance this cursor if the current token is a
Token::Integer
If the current token is Integer, returns the integer as well as a new
Cursor pointing at the rest of the tokens in the stream. Otherwise
returns None.
pub fn float(self) -> Option<(&'a Float<'a>, Self)>[src]
Attempts to advance this cursor if the current token is a
Token::Float
If the current token is Float, returns the float as well as a new
Cursor pointing at the rest of the tokens in the stream. Otherwise
returns None.
pub fn string(self) -> Option<(&'a [u8], Self)>[src]
Attempts to advance this cursor if the current token is a
Token::String
If the current token is String, returns the byte value of the string
as well as a new Cursor pointing at the rest of the tokens in the
stream. Otherwise returns None.
Trait Implementations
Auto Trait Implementations
impl<'a> !Send for Cursor<'a>
impl<'a> !Sync for Cursor<'a>
impl<'a> Unpin for Cursor<'a>
impl<'a> !UnwindSafe for Cursor<'a>
impl<'a> !RefUnwindSafe for Cursor<'a>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,