[−][src]Struct soup::Soup
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 get_handle(&self) -> Handle
[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]
&self,
tag: P
) -> QueryBuilder<'a, TagQuery<P>, QueryWrapper<'a, (), ()>>
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]
&self,
name: P
) -> QueryBuilder<'a, AttrQuery<P, bool>, QueryWrapper<'a, (), ()>> where
P: Pattern,
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]
&self,
value: P
) -> QueryBuilder<'a, AttrQuery<bool, P>, QueryWrapper<'a, (), ()>> where
P: Pattern,
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]
&self,
name: P,
value: Q
) -> QueryBuilder<'a, AttrQuery<P, Q>, QueryWrapper<'a, (), ()>> where
P: Pattern,
Q: Pattern,
Starts building a Query, with attr attr
fn class<'a, P: Pattern>(
&self,
value: P
) -> QueryBuilder<'a, AttrQuery<&'static str, P>, QueryWrapper<'a, (), ()>>
[src]
&self,
value: P
) -> QueryBuilder<'a, AttrQuery<&'static str, P>, QueryWrapper<'a, (), ()>>
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(&self) -> 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
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,