Trait wast::parser::Peek [−][src]
A trait for types which be used to “peek” to see if they’re the next token
in an input stream of Parser.
Often when implementing Parse you’ll need to query what the next token
in the stream is to figure out what to parse next. This Peek trait
defines the set of types that can be tested whether they’re the next token
in the input stream.
Implementations of Peek should only be present on types that consume
exactly one token (not zero, not more, exactly one). Types implementing
Peek should also typically implement Parse should also typically
implement Parse.
See the documentation of Parser::peek for example usage.
Required methods
fn peek(cursor: Cursor<'_>) -> bool[src]
Tests to see whether this token is the first token within the Cursor
specified.
Returns true if Parse for this type is highly likely to succeed
failing no other error conditions happening (like an integer literal
being too big).
fn display() -> &'static str[src]
Returns a human-readable name of this token to display when generating errors about this token missing.
Provided methods
fn peek2(cursor: Cursor<'_>) -> bool[src]
The same as peek, except it checks the token immediately following
the current token.