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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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.