Struct html5tokenizer::token::AttributeMap
source · pub struct AttributeMap { /* private fields */ }
Expand description
A map of HTML attributes.
Does not preserve the order of attributes. Iterating always yields attributes in order by name.
Example
let attrs: AttributeMap = vec![("href".into(), "http://example.com".into())]
.into_iter()
.collect();
assert_eq!(&attrs["href"], "http://example.com");
Implementations§
source§impl AttributeMap
impl AttributeMap
sourcepub fn get(&self, name: &str) -> Option<&str>
pub fn get(&self, name: &str) -> Option<&str>
Returns the value for the given attribute name.
The name must not contain any uppercase ASCII character (A-Z)
or the method will always return None
.
sourcepub fn value_and_trace_idx(
&self,
name: &str
) -> Option<(&str, Option<AttributeTraceIdx>)>
pub fn value_and_trace_idx( &self, name: &str ) -> Option<(&str, Option<AttributeTraceIdx>)>
Returns the value and trace index for a given attribute name.
The name must not contain any uppercase ASCII character (A-Z)
or the method will always return None
.
Trait Implementations§
source§impl Clone for AttributeMap
impl Clone for AttributeMap
source§fn clone(&self) -> AttributeMap
fn clone(&self) -> AttributeMap
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for AttributeMap
impl Debug for AttributeMap
source§impl Default for AttributeMap
impl Default for AttributeMap
source§fn default() -> AttributeMap
fn default() -> AttributeMap
Returns the “default value” for a type. Read more
source§impl FromIterator<(String, String)> for AttributeMap
impl FromIterator<(String, String)> for AttributeMap
source§impl Index<&str> for AttributeMap
impl Index<&str> for AttributeMap
source§impl<'a> IntoIterator for &'a AttributeMap
impl<'a> IntoIterator for &'a AttributeMap
source§impl IntoIterator for AttributeMap
impl IntoIterator for AttributeMap
source§impl PartialEq for AttributeMap
impl PartialEq for AttributeMap
source§fn eq(&self, other: &AttributeMap) -> bool
fn eq(&self, other: &AttributeMap) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for AttributeMap
impl StructuralEq for AttributeMap
impl StructuralPartialEq for AttributeMap
Auto Trait Implementations§
impl RefUnwindSafe for AttributeMap
impl Send for AttributeMap
impl Sync for AttributeMap
impl Unpin for AttributeMap
impl UnwindSafe for AttributeMap
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
Mutably borrows from an owned value. Read more