[][src]Struct htmldom_read::Attribute

pub struct Attribute { /* fields omitted */ }

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_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Attribute[src]

Auto Trait Implementations

impl Send for Attribute

impl Sync for Attribute

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.