pub enum Attributes {
Static(&'static [(&'static str, AttributeOrProperty)]),
Dynamic {
keys: &'static [&'static str],
values: Box<[Option<AttributeOrProperty>]>,
},
IndexMap(Rc<IndexMap<AttrValue, AttributeOrProperty>>),
}
Expand description
A collection of attributes for an element
Variants§
Static(&'static [(&'static str, AttributeOrProperty)])
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
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.
Fields
IndexMap(Rc<IndexMap<AttrValue, AttributeOrProperty>>)
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.
This function only returns attributes
Sourcepub fn get_mut_index_map(
&mut self,
) -> &mut IndexMap<AttrValue, AttributeOrProperty>
pub fn get_mut_index_map( &mut self, ) -> &mut IndexMap<AttrValue, AttributeOrProperty>
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>> for Attributes
impl From<IndexMap<&'static str, IString>> for Attributes
Source§impl From<IndexMap<IString, IString>> for Attributes
impl From<IndexMap<IString, IString>> for Attributes
Source§impl PartialEq for Attributes
impl PartialEq for Attributes
impl StructuralPartialEq for Attributes
Auto Trait Implementations§
impl Freeze for Attributes
impl RefUnwindSafe for Attributes
impl !Send for Attributes
impl !Sync for Attributes
impl Unpin for Attributes
impl UnwindSafe for Attributes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.