Enum yew::virtual_dom::Attributes[][src]

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

A collection of attributes for an element

Variants

Static(&'static [[&'static str; 2]])

Tuple Fields

0: &'static [[&'static str; 2]]

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>]>

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<&'static str, AttrValue>)

Tuple Fields

0: IndexMap<&'static str, AttrValue>

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

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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.