[][src]Struct soup::Soup

pub struct Soup { /* fields omitted */ }

Parses HTML & provides methods to query & manipulate the document

Methods

impl Soup[src]

pub fn new(html: &str) -> Soup[src]

Create a new Soup instance from a string slice

Example

let html = r#"
<!doctype html>
<html>
  <head>
    <title>page title</title>
  </head>
  <body>
    <h1>Heading</h1>
    <p>Some text</p>
    <p>Some more text</p>
  </body>
</html>
"#;

let soup = Soup::new(html);

pub fn from_reader<R: Read>(reader: R) -> Result<Soup>[src]

Create a new Soup instance from something that implements Read

This is good for parsing the output of an HTTP response, for example.

use soup::prelude::*;

let response = reqwest::get("https://docs.rs/soup")?;
let soup = Soup::from_reader(response)?;

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

Extracts all text from the HTML

Trait Implementations

impl QueryBuilderExt for Soup[src]

fn limit<'a>(&self, limit: usize) -> QueryBuilder<'a, (), ()>[src]

Starts building a Query, with limit limit

fn tag<'a, P: Pattern>(
    &self,
    tag: P
) -> QueryBuilder<'a, TagQuery<P>, QueryWrapper<'a, (), ()>>
[src]

Starts building a Query, with tag tag

fn attr_name<'a, P>(
    &self,
    name: P
) -> QueryBuilder<'a, AttrQuery<P, bool>, QueryWrapper<'a, (), ()>> where
    P: Pattern
[src]

Starts building a Query, with attr name name

fn attr_value<'a, P>(
    &self,
    value: P
) -> QueryBuilder<'a, AttrQuery<bool, P>, QueryWrapper<'a, (), ()>> where
    P: Pattern
[src]

Starts building a Query, with attr value value

fn attr<'a, P, Q>(
    &self,
    name: P,
    value: Q
) -> QueryBuilder<'a, AttrQuery<P, Q>, QueryWrapper<'a, (), ()>> where
    P: Pattern,
    Q: Pattern
[src]

Starts building a Query, with attr attr

fn class<'a, P: Pattern>(
    &self,
    value: P
) -> QueryBuilder<'a, AttrQuery<&'static str, P>, QueryWrapper<'a, (), ()>>
[src]

Starts building a Query, with class class

fn recursive<'a>(&self, recursive: bool) -> QueryBuilder<'a, (), ()>[src]

Starts building a Query, with recursion set to recursive

fn children(&self) -> NodeChildIter[src]

Returns an iterator over the node's children Read more

fn parents(&self) -> NodeParentIter[src]

Iterator over the parents of a node Read more

impl Clone for Soup[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl From<RcDom> for Soup[src]

impl Debug for Soup[src]

Auto Trait Implementations

impl !Send for Soup

impl !Sync for Soup

Blanket Implementations

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> Into for T where
    U: From<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> 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.

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