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§
sourcefn peek(input: ParseStream<'_>) -> bool
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.