[−][src]Struct htmldom_read::Attribute
Attribute of the tag.
Methods
impl Attribute
[src]
pub fn from_name_and_str_values(name: String, values: &str) -> Self
[src]
Create from a name and values passed as single string that are separated by whitespaces.
pub fn from_name_and_values(name: String, values: Vec<String>) -> Option<Self>
[src]
Create from a name and values passed as array of strings. They should not contain whitespaces and invalid characters for attributes or names.
pub fn name(&self) -> &str
[src]
The name of the attribute.
pub fn values(&self) -> &Vec<String>
[src]
All values stored in the attribute. Each value separated with whitespace is
located in another string in the array. To get values as single string, use
[values_to_string
]
pub fn values_to_string(&self) -> String
[src]
Store all values in a string separated with spaces.
pub fn first_value(&self) -> &String
[src]
Get first value of the attribute if any.
Usually, when attribute is known to contain single value this function makes it easier
to obtain this value. It does not construct new string as values_to_string
and
is shorter than calling values
and gettings first value manually (but is equivalent).
Panics
This function will panic if there are no attribute values.
pub fn set_name(&mut self, name: String)
[src]
Set new name for attribute.
pub fn set_values(&mut self, values: Vec<String>) -> Result<(), ()>
[src]
Set new values for attribute. If any of passed strings have whitespaces then this function will fail.
pub fn set_values_from_str(&mut self, values: &str) -> Result<(), ()>
[src]
Set values from string.
Trait Implementations
impl PartialEq<Attribute> for Attribute
[src]
impl Clone for Attribute
[src]
fn clone(&self) -> Attribute
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Attribute
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,