Trait attribute_derive::parsing::AttributePeekable

source ·
pub trait AttributePeekable {
    // Required method
    fn peek(input: ParseStream<'_>) -> bool;
}
Expand description

Trait implemented for attributes that can be parsed optionally as a positional argument, and the requirement for Option<T> to implement AttributePositional.

Required Methods§

source

fn peek(input: ParseStream<'_>) -> bool

Used to decide whether to parse optional positional values.

While most implementations should not mutate input, it might be good to call this on a fork of the original ParseStream to ensure no mutation is persisted.

§Implementation notes

This should not try to parse input, if you cannot decide if input matches using ParseBuffer::peek (peek2, peek3), consider not implementing AttributePeekable.

attribute-derive will always fork before calling this function to allow peek to modify input without effecting further parsing.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl AttributePeekable for bool

source§

fn peek(input: ParseStream<'_>) -> bool

source§

impl<T> AttributePeekable for Vec<T>

source§

fn peek(input: ParseStream<'_>) -> bool

Implementors§