attribute_derive::parsing

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§