Expand description
Making proc-macro easy.
Modules
Macros
Defines argument group as enum where each variant is argument type.
Defines argument structure.
First field is a argument name.
It must be EasyToken
implementation that will be used to for EasyPeek
implementation.
Following fields must be EasyArgumentField
and are expected to be in parenthesized and parsed in any order.
If name is not followed by parentheses, all fields are missing.
In case of errors, argument name and span will be used.
Defines argument structure of two fields.
First field is a argument name.
It must be EasyToken
implementation that will be used to for EasyPeek
implementation.
Second field must be EasyArgumentField
and is expected to follow =
token.
If name is not followed by =
, second field is missing.
In case of errors, argument name and span will be used.
Defines struct and implement EasyAttributes
for it.
Each field’s type must implement EasyArgumentField
.
Defines flags and attribute group and fields for them. Flags can be parsed independently. They can be parsed inside attribute that can contain only one flag. They can be parsed inside attribute that accepts a list of flags if provided.
Defines structure or enum and implements Parse
for it
Defines structure and implements Parse
for it.
Defines structure and implements Parse
for it.
Produces type with specified name that implement EasyToken
and can be parsed from the name ident.
Structs
Parses inner type braced.
Implements EasyPeek
and peeks opening brace.
Parses inner type bracketed.
Implements EasyPeek
and peeks opening bracket.
Parses inner type parenthesized.
Implements EasyPeek
and peeks opening parenthesis.
Similar to syn::punctuated::Punctuated
that implements Parse
and possibly EasyPeek
.
Parses one or more occurrences of T separated by punctuation of type P, not accepting trailing punctuation.
Parsing continues as long as punctuation P is present at the head of the stream. This method returns upon parsing a T and observing that it is not followed by a P, even if there are remaining tokens in the stream.
Similar to syn::punctuated::Punctuated
that implements Parse
.
Parses zero or more occurrences of T separated by punctuation of type P, with optional trailing punctuation.
Parsing continues until the end of this parse stream. The entire content of this parse stream must consist of T and P.
Enums
Either value preceded by =
or tuple sub-fields.
Expression that may be a constant or a reference to member field. Often used pattern is having attribute that refer to a field or constant expression.
Traits
Trait for parsable attributes. Attributes should be peekable to choose which attribute to parse.
Trait for types that can be used as fields in easy attributes structures.
Fields can parsed and extended when encountered again in parsing stream.
If field is never encountered - [missing
] value will be used.
If attribute type or group is not mandatory - wrap it into Option
.
Trait that should be implemented for enums of where each variant is an attribute.
It is also auto-implemented for all bare attributes.
This trait is used to implement EasyArgumentField
for various types.
Collection of attributes that can be parsed from array of attributes. Can be easily applied to field’s or type’s attributes vector.
Provides interface for peeking tokens before parsing. When implemented for complex structures, peeks first token.
Peekable, parsable token.