Skip to main content

ArticleTextNode

Struct ArticleTextNode 

Source
pub struct ArticleTextNode<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> ArticleTextNode<'a>

Source

pub fn new(inner: Node<'a>) -> Self

Source

pub fn clean_text(&self) -> String

Extract the content from the node, but ignore those that not contain parts of the article

Source

pub fn images(&self, base_url: Option<&Url>) -> Vec<Url>

Extract all of the images of the document.

Source

pub fn references(&self) -> Vec<Url>

Extract all the links within the node’s descendants

Source

pub fn videos(&self) -> Vec<VideoNode<'a>>

Extract all the nodes that hold video data

Methods from Deref<Target = Node<'a>>§

Source

pub fn index(&self) -> usize

Get the index of this Node in its Document.

Source

pub fn raw(&self) -> &'a Raw

Obtain the inner representation of this Node.

Source

pub fn data(&self) -> &'a Data

Get the text node, HTML element, or comment from a Node.

Source

pub fn name(&self) -> Option<&'a str>

Get the name of a Node if it is an HTML element, or None otherwise.

Source

pub fn attr(&self, name: &str) -> Option<&'a str>

Get the value of the attribute name from a Node representing a HTML element.

Source

pub fn attrs(&self) -> Attrs<'a> ⓘ

Get an iterator over the names and values of attributes of the Element. Returns an empty iterator for non Element nodes.

Source

pub fn parent(&self) -> Option<Node<'a>>

Source

pub fn prev(&self) -> Option<Node<'a>>

Source

pub fn next(&self) -> Option<Node<'a>>

Source

pub fn first_child(&self) -> Option<Node<'a>>

Source

pub fn last_child(&self) -> Option<Node<'a>>

Source

pub fn text(&self) -> String

Get the combined textual content of a Node and all of its children.

Source

pub fn html(&self) -> String

Serialize a Node to an HTML string.

Source

pub fn inner_html(&self) -> String

Serialize a Node’s children to an HTML string.

Source

pub fn find<P>(&self, predicate: P) -> Find<'a, P> ⓘ
where P: Predicate,

Search for Nodes fulfilling predicate in the descendants of a Node.

Source

pub fn is<P>(&self, p: P) -> bool
where P: Predicate,

Evaluate a predicate on this Node.

Source

pub fn as_text(&self) -> Option<&'a str>

Get the text of a text Node, or None if the node is not text.

Source

pub fn as_comment(&self) -> Option<&'a str>

Get the text of a comment Node, or None if the node is not a comment.

Source

pub fn children(&self) -> Children<'a> ⓘ

Construct an iterator over a Node’s child Nodes.

Source

pub fn descendants(&self) -> Descendants<'a> ⓘ

Construct an iterator over a Node’s descendant (transitive children) Nodes.

Trait Implementations§

Source§

impl<'a> Clone for ArticleTextNode<'a>

Source§

fn clone(&self) -> ArticleTextNode<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for ArticleTextNode<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Deref for ArticleTextNode<'a>

Source§

type Target = Node<'a>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ArticleTextNode<'a>

§

impl<'a> !Send for ArticleTextNode<'a>

§

impl<'a> !Sync for ArticleTextNode<'a>

§

impl<'a> !UnwindSafe for ArticleTextNode<'a>

§

impl<'a> Freeze for ArticleTextNode<'a>

§

impl<'a> Unpin for ArticleTextNode<'a>

§

impl<'a> UnsafeUnpin for ArticleTextNode<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more