[][src]Struct marked::Element

pub struct Element {
    pub name: QualName,
    pub attrs: Vec<Attribute>,
}

A markup element with name and attributes.

Fields

name: QualNameattrs: Vec<Attribute>

Methods

impl Element[src]

pub fn new<LN>(lname: LN) -> Element where
    LN: Into<LocalName>, 
[src]

Construct new element by local name, with no attributes.

pub fn is_elem<LN>(&self, lname: LN) -> bool where
    LN: Into<LocalName>, 
[src]

Return true if this element has the given local name.

pub fn html_tag_meta(&self) -> Option<&'static TagMeta>[src]

Return html::TagMeta for this element, if the tag is a known part of the HTML Namespace.

pub fn attr<LN>(&self, lname: LN) -> Option<&StrTendril> where
    LN: Into<LocalName>, 
[src]

Return attribute value by local name, if present.

pub fn remove_attr<LN>(&mut self, lname: LN) -> Option<StrTendril> where
    LN: Into<LocalName>, 
[src]

Remove attribute by local name, returning any value found.

This removes all instances of attributes with the given local name and returns the value of the last such attribute. Parsers may allow same named attributes or multiples might be introduced via manual mutations.

pub fn set_attr<LN, V>(&mut self, lname: LN, value: V) -> Option<StrTendril> where
    LN: Into<LocalName>,
    V: Into<StrTendril>, 
[src]

Set attribute by local name, returning any prior value found.

This replaces the value of the first attribute with the given local name and removes any other instances. If no existing attribute is found, the attribute is added to the end. To guarantee placement at the end, use Element::remove_attr first. In the case where multiple existing instances of the attribute are found, the last value is returned. Parsers may allow same named attributes or multiples might be introduced via manual mutations.

Trait Implementations

impl Clone for Element[src]

impl Debug for Element[src]

Auto Trait Implementations

impl !RefUnwindSafe for Element

impl !Send for Element

impl !Sync for Element

impl Unpin for Element

impl UnwindSafe for Element

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> 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, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.