Expand description
Traits for parsing attributes.
This module defines traits for attribute parsers, little state machines that recognize and parse
attributes out of a longer list of attributes. The main trait is called AttributeParser.
You can find more docs about AttributeParsers on the trait itself.
However, for many types of attributes, implementing AttributeParser is not necessary.
It allows for a lot of flexibility you might not want.
Specifically, you might not care about managing the state of your AttributeParser
state machine yourself. In this case you can choose to implement:
NoArgsAttributeParser: used for implementing an attribute that appears only once and accepts no argumentsSingleAttributeParser: makes it easy to implement an attribute which should error if it appears more than once in a list of attributesCombineAttributeParser: makes it easy to implement an attribute which should combine the contents of attributes, if an attribute appear multiple times in a list
Attributes should be added to crate::context::ATTRIBUTE_PARSERS to be parsed.
Modulesยง
- allow_
unstable ๐ - autodiff ๐
- body ๐
- Attributes that can be found in function body.
- cfg ๐
- cfg_
select ๐ - cfi_
encoding ๐ - codegen_
attrs ๐ - confusables ๐
- crate_
level ๐ - debugger ๐
- deprecation ๐
- diagnostic ๐
- doc ๐
- dummy ๐
- inline ๐
- instruction_
set ๐ - link_
attrs ๐ - lint_
helpers ๐ - loop_
match ๐ - macro_
attrs ๐ - must_
not_ ๐suspend - must_
use ๐ - no_
implicit_ ๐prelude - no_link ๐
- non_
exhaustive ๐ - path ๐
- pin_v2 ๐
- prelude ๐
- All the parsers require roughly the same imports, so this prelude has most of the often-needed ones.
- proc_
macro_ ๐attrs - prototype ๐
- Attributes that are only used on function prototypes.
- repr ๐
- rustc_
allocator ๐ - rustc_
dump ๐ - rustc_
internal ๐ - semantics ๐
- splat ๐
- Attribute parsing for the
#[splat]function argument overloading attribute. This attribute modifies typecheck to support overload resolution, then modifies codegen for performance. - stability ๐
- test_
attrs ๐ - traits ๐
- transparency ๐
- util ๐
Structsยง
- Combine ๐
- Use in combination with
CombineAttributeParser.Combine<T: CombineAttributeParser>implementsAttributeParser. - Single ๐
- Use in combination with
SingleAttributeParser.Single<T: SingleAttributeParser>implementsAttributeParser. - Without
Args ๐
Enumsยง
Traitsยง
- Attribute
Parser ๐ - An
AttributeParseris a type which searches for syntactic attributes. - Combine
Attribute ๐Parser - Alternative to
AttributeParserthat automatically handles state management. If multiple attributes appear on an element, combines the values of each into aThinVec.Combine<T> where T: CombineAttributeParserimplementsAttributeParser. - NoArgs
Attribute ๐Parser - An even simpler version of
SingleAttributeParser: now automatically check that there are no arguments provided to the attribute. - Single
Attribute ๐Parser - Alternative to
AttributeParserthat automatically handles state management. A slightly simpler and more restricted way to convert attributes. Assumes that an attribute can only appear a single time on an item, and errors when it sees more.
Type Aliasesยง
- Accept
Fn ๐ - Accept
Mapping ๐ - Convert
Fn ๐