[][src]Struct arquery::Element

pub struct Element { /* fields omitted */ }

Represents a single element in the DOM tree.

Methods

impl Element[src]

pub fn select_all<'a>(
    &'a self,
    selector: &str
) -> Result<Box<dyn Iterator<Item = &'a Element> + 'a>, SelectError>
[src]

Searches the elements children for elements matching the given CSS selector.

pub fn select<'a>(&'a self, selector: &str) -> Result<&'a Element, SelectError>[src]

Just like select_all but only returns the first match.

pub fn children_iter<'a>(&'a self) -> Box<dyn Iterator<Item = &'a Element> + 'a>[src]

Returns an iterator over the element’s direct children.

pub fn children_deep_iter<'a>(
    &'a self
) -> Box<dyn Iterator<Item = &'a Element> + 'a>
[src]

Returns an iterator over all the element’s children, including indirect child elements.

pub fn subtree_size(&self) -> usize[src]

Returns the size of the DOM subtree, including the current element.

pub fn tag_name(&self) -> &str[src]

Returns the name of the element’s tag.

pub fn attr(&self, attr_name: &str) -> Option<&String>[src]

Returns the value of the element attribute if found.

pub fn text(&self) -> &String[src]

Returns the text contained within the element.

pub fn matches(&self, compound_selector: &CompoundSelector) -> bool[src]

Returns true if the element matches the given selector.

pub fn node_index(&self) -> usize[src]

Returns the node index for the element.

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.