Module attributes

Source
Expand description

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:

  • SingleAttributeParser: makes it easy to implement an attribute which should error if it appears more than once in a list of attributes
  • CombineAttributeParser: 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 ATTRIBUTE_MAPPING to be parsed.

Modules§

allow_unstable 🔒
cfg 🔒
confusables 🔒
deprecation 🔒
repr 🔒
rustc 🔒
stability 🔒
transparency 🔒
util 🔒

Structs§

Combine 🔒
Single 🔒

Traits§

AttributeParser 🔒
An AttributeParser is a type which searches for syntactic attributes.
CombineAttributeParser 🔒
Alternative to AttributeParser that automatically handles state management. If multiple attributes appear on an element, combines the values of each into a ThinVec. Combine<T> where T: CombineAttributeParser implements AttributeParser.
SingleAttributeParser 🔒
Alternative to AttributeParser that 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§

AcceptFn 🔒
AcceptMapping 🔒
ConvertFn 🔒