Enum yew::virtual_dom::Attributes
source · 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
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§
source§impl Attributes
impl Attributes
sourcepub fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (&'a str, &'a str)> + 'a>
pub fn iter<'a>(&'a self) -> Box<dyn Iterator<Item = (&'a str, &'a str)> + 'a>
Return iterator over attribute key-value pairs. This function is suboptimal and does not inline well. Avoid on hot paths.
sourcepub fn get_mut_index_map(
&mut self
) -> &mut IndexMap<AttrValue, (AttrValue, ApplyAttributeAs)>
pub fn get_mut_index_map(
&mut self
) -> &mut IndexMap<AttrValue, (AttrValue, ApplyAttributeAs)>
Get a mutable reference to the underlying IndexMap
.
If the attributes are stored in the Vec
variant, it will be converted.
Trait Implementations§
source§impl Clone for Attributes
impl Clone for Attributes
source§fn clone(&self) -> Attributes
fn clone(&self) -> Attributes
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for Attributes
impl Debug for Attributes
source§impl Default for Attributes
impl Default for Attributes
source§impl From<IndexMap<&'static str, IString, RandomState>> for Attributes
impl From<IndexMap<&'static str, IString, RandomState>> for Attributes
source§impl From<IndexMap<IString, IString, RandomState>> for Attributes
impl From<IndexMap<IString, IString, RandomState>> for Attributes
source§impl PartialEq<Attributes> for Attributes
impl PartialEq<Attributes> for Attributes
source§fn eq(&self, other: &Attributes) -> bool
fn eq(&self, other: &Attributes) -> bool
impl Eq for Attributes
impl StructuralEq for Attributes
impl StructuralPartialEq for Attributes
Auto Trait Implementations§
impl RefUnwindSafe for Attributes
impl !Send for Attributes
impl !Sync for Attributes
impl Unpin for Attributes
impl UnwindSafe for Attributes
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.