pub enum Attributes {
    Static(&'static [(&'static str, &'static str, ApplyAttributeAs)]),
    Dynamic {
        keys: &'static [&'static str],
        values: Box<[Option<(AttrValue, ApplyAttributeAs)>]>,
    },
    IndexMap(IndexMap<AttrValue, (AttrValue, ApplyAttributeAs)>),
}
Expand description

A collection of attributes for an element

Variants§

§

Static(&'static [(&'static str, &'static str, ApplyAttributeAs)])

Static list of attributes.

Allows optimizing comparison to a simple pointer equality check and reducing allocations, if the attributes do not change on a node.

§

Dynamic

Fields

§keys: &'static [&'static str]

Attribute keys. Includes both always set and optional attribute keys.

§values: Box<[Option<(AttrValue, ApplyAttributeAs)>]>

Attribute values. Matches keys. Optional attributes are designated by setting None.

Static list of attribute keys with possibility to exclude attributes and dynamic attribute values.

Allows optimizing comparison to a simple pointer equality check and reducing allocations, if the attributes keys do not change on a node.

§

IndexMap(IndexMap<AttrValue, (AttrValue, ApplyAttributeAs)>)

IndexMap is used to provide runtime attribute deduplication in cases where the html! macro was not used to guarantee it.

Implementations§

Construct a default Attributes instance

Return iterator over attribute key-value pairs. This function is suboptimal and does not inline well. Avoid on hot paths.

Get a mutable reference to the underlying IndexMap. If the attributes are stored in the Vec variant, it will be converted.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more