#[non_exhaustive]pub enum Attributes {
}Expand description
A collection of attributes for an element
Implementations§
Source§impl Attributes
impl Attributes
Sourcepub fn from_static(
statics: &'static [(&'static str, AttributeOrProperty)],
) -> Self
pub fn from_static( statics: &'static [(&'static str, AttributeOrProperty)], ) -> Self
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.
Sourcepub fn from_static_unchecked(
statics: &'static [(&'static str, AttributeOrProperty)],
) -> Self
pub fn from_static_unchecked( statics: &'static [(&'static str, AttributeOrProperty)], ) -> Self
Same as Self::from_static but without verifying keys. This can lead to loss of validity of an SSR document!
Sourcepub fn from_dynamic_values(
keys: &'static [&'static str],
values: Box<[Option<AttributeOrProperty>]>,
) -> Self
pub fn from_dynamic_values( keys: &'static [&'static str], values: Box<[Option<AttributeOrProperty>]>, ) -> Self
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.
Sourcepub fn from_dynamic_values_unchecked(
keys: &'static [&'static str],
values: Box<[Option<AttributeOrProperty>]>,
) -> Self
pub fn from_dynamic_values_unchecked( keys: &'static [&'static str], values: Box<[Option<AttributeOrProperty>]>, ) -> Self
Same as Self::from_dynamic_values but without verifying keys. This can lead to loss of validity of an SSR document!
Sourcepub fn from_index_map(map: Rc<IndexMap<AttrValue, AttributeOrProperty>>) -> Self
pub fn from_index_map(map: Rc<IndexMap<AttrValue, AttributeOrProperty>>) -> Self
IndexMap is used to provide runtime attribute deduplication in cases where the html! macro was not used to guarantee it.
Sourcepub fn from_index_map_unchecked(
map: Rc<IndexMap<AttrValue, AttributeOrProperty>>,
) -> Self
pub fn from_index_map_unchecked( map: Rc<IndexMap<AttrValue, AttributeOrProperty>>, ) -> Self
Same as Self::from_index_map but without verifying keys. This can lead to loss of validity of an SSR document!
Sourcepub fn is_valid_attr_key(name: &str) -> bool
pub fn is_valid_attr_key(name: &str) -> bool
Validate a single attribute name for validity to be used as a key for an attribute or
property. All keys must be valid according to this method when constructing
Attributes. Usually, this is ensured by the usage context.
Specifically, this checks that the passed string is a valid XHTML attribute name. This implies that it consists of at least one character, does not contain whitespace or other special characters.
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_unchecked(
&mut self,
) -> &mut IndexMap<AttrValue, AttributeOrProperty>
pub fn get_mut_index_map_unchecked( &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.
The caller is responsible to check that inserted attribute names are valid, see
Self::is_valid_attr_key
Trait Implementations§
Source§impl Clone for Attributes
impl Clone for Attributes
Source§fn clone(&self) -> Attributes
fn clone(&self) -> Attributes
1.0.0 (const: unstable) · 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
Source§fn eq(&self, other: &Attributes) -> bool
fn eq(&self, other: &Attributes) -> bool
self and other values to be equal, and is used by ==.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 UnsafeUnpin 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.