Struct soup::Soup

source ·
pub struct Soup { /* private fields */ }
Expand description

Parses HTML & provides methods to query & manipulate the document

Implementations§

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);

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)?;

Starts building a Query, with limit limit

Starts building a Query, with tag tag

Starts building a Query, with attr attr

Starts building a Query, with class class

Extracts all text from the HTML

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.