[][src]Trait wast::parser::Peek

pub trait Peek {
    fn peek(cursor: Cursor<'_>) -> bool;
fn display() -> &'static str; fn peek2(cursor: Cursor<'_>) -> bool { ... } }

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

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

Returns a human-readable name of this token to display when generating errors about this token missing.

Loading content...

Provided methods

fn peek2(cursor: Cursor<'_>) -> bool

The same as peek, except it checks the token immediately following the current token.

Loading content...

Implementations on Foreign Types

impl Peek for u8[src]

impl Peek for u16[src]

impl Peek for u32[src]

impl Peek for u64[src]

impl Peek for i8[src]

impl Peek for i16[src]

impl Peek for i32[src]

impl Peek for i64[src]

impl<'_> Peek for &'_ [u8][src]

impl<'_> Peek for &'_ str[src]

Loading content...

Implementors

impl Peek for custom[src]

impl Peek for name[src]

impl Peek for after[src]

impl Peek for alias[src]

impl Peek for any[src]

impl Peek for anyfunc[src]

impl Peek for anyref[src]

impl Peek for array[src]

impl Peek for assert_exhaustion[src]

impl Peek for assert_invalid[src]

impl Peek for assert_malformed[src]

impl Peek for assert_return[src]

impl Peek for assert_return_arithmetic_nan[src]

impl Peek for assert_return_arithmetic_nan_f32x4[src]

impl Peek for assert_return_arithmetic_nan_f64x2[src]

impl Peek for assert_return_canonical_nan[src]

impl Peek for assert_return_canonical_nan_f32x4[src]

impl Peek for assert_return_canonical_nan_f64x2[src]

impl Peek for assert_return_func[src]

impl Peek for assert_trap[src]

impl Peek for assert_unlinkable[src]

impl Peek for before[src]

impl Peek for binary[src]

impl Peek for block[src]

impl Peek for catch[src]

impl Peek for code[src]

impl Peek for data[src]

impl Peek for declare[src]

impl Peek for do[src]

impl Peek for elem[src]

impl Peek for else[src]

impl Peek for end[src]

impl Peek for eq[src]

impl Peek for eqref[src]

impl Peek for event[src]

impl Peek for exn[src]

impl Peek for exnref[src]

impl Peek for export[src]

impl Peek for extern[src]

impl Peek for externref[src]

impl Peek for f32[src]

impl Peek for f32x4[src]

impl Peek for f64[src]

impl Peek for f64x2[src]

impl Peek for field[src]

impl Peek for first[src]

impl Peek for func[src]

impl Peek for funcref[src]

impl Peek for get[src]

impl Peek for global[src]

impl Peek for i8[src]

impl Peek for i8x16[src]

impl Peek for i16[src]

impl Peek for i16x8[src]

impl Peek for i31[src]

impl Peek for i31ref[src]

impl Peek for i32[src]

impl Peek for i32x4[src]

impl Peek for i64[src]

impl Peek for i64x2[src]

impl Peek for if[src]

impl Peek for import[src]

impl Peek for instance[src]

impl Peek for instantiate[src]

impl Peek for invoke[src]

impl Peek for item[src]

impl Peek for last[src]

impl Peek for local[src]

impl Peek for loop[src]

impl Peek for memory[src]

impl Peek for module[src]

impl Peek for modulecode[src]

impl Peek for mut[src]

impl Peek for nan_arithmetic[src]

impl Peek for nan_canonical[src]

impl Peek for null[src]

impl Peek for nullref[src]

impl Peek for offset[src]

impl Peek for param[src]

impl Peek for parent[src]

impl Peek for passive[src]

impl Peek for quote[src]

impl Peek for ref[src]

impl Peek for ref_func[src]

impl Peek for ref_null[src]

impl Peek for register[src]

impl Peek for result[src]

impl Peek for rtt[src]

impl Peek for shared[src]

impl Peek for start[src]

impl Peek for struct[src]

impl Peek for table[src]

impl Peek for then[src]

impl Peek for try[src]

impl Peek for type[src]

impl Peek for v128[src]

impl Peek for LParen[src]

impl<'_> Peek for Index<'_>[src]

impl<'_> Peek for Id<'_>[src]

impl<'_> Peek for InlineExport<'_>[src]

impl<'_> Peek for InlineImport<'_>[src]

impl<'a> Peek for HeapType<'a>[src]

impl<'a> Peek for ValType<'a>[src]

impl<'a> Peek for FunctionType<'a>[src]

impl<'a> Peek for FunctionTypeNoNames<'a>[src]

impl<'a> Peek for InstanceType<'a>[src]

impl<'a> Peek for ModuleType<'a>[src]

impl<'a> Peek for RefType<'a>[src]

Loading content...