pub struct Scraper<'a> { /* private fields */ }
Expand description
Responsible for scraping data from html elements.
Implementations§
Source§impl<'a> Scraper<'a>
Properties
impl<'a> Scraper<'a>
Properties
Sourcepub fn element(&self) -> ElementRef<'_>
pub fn element(&self) -> ElementRef<'_>
Gets the element.
Source§impl<'a> Scraper<'a>
All
impl<'a> Scraper<'a>
All
Sourcepub fn all<T, F>(
&self,
selection: &str,
scrape: F,
) -> Result<Vec<T>, ScrapeError>
pub fn all<T, F>( &self, selection: &str, scrape: F, ) -> Result<Vec<T>, ScrapeError>
Scrapes all the instances of the selection
.
Sourcepub fn all_text(&self, selection: &str) -> Result<Vec<String>, ScrapeError>
pub fn all_text(&self, selection: &str) -> Result<Vec<String>, ScrapeError>
Scrapes all the text from the selection
.
Source§impl<'a> Scraper<'a>
Only
impl<'a> Scraper<'a>
Only
Sourcepub fn only<T, F>(&self, selection: &str, scrape: F) -> Result<T, ScrapeError>
pub fn only<T, F>(&self, selection: &str, scrape: F) -> Result<T, ScrapeError>
Scrapes the only instance of the selection
.
Sourcepub fn only_att(
&self,
selection: &str,
att: &str,
) -> Result<String, ScrapeError>
pub fn only_att( &self, selection: &str, att: &str, ) -> Result<String, ScrapeError>
Scrapes the only instance of the selection
attribute.
Source§impl<'a> Scraper<'a>
Optional
impl<'a> Scraper<'a>
Optional
Sourcepub fn optional<T, F>(
&self,
selection: &str,
scrape: F,
) -> Result<Option<T>, ScrapeError>
pub fn optional<T, F>( &self, selection: &str, scrape: F, ) -> Result<Option<T>, ScrapeError>
Scrapes the optional instance of the selection
.
Sourcepub fn optional_text(
&self,
selection: &str,
) -> Result<Option<String>, ScrapeError>
pub fn optional_text( &self, selection: &str, ) -> Result<Option<String>, ScrapeError>
Scrapes the optional instance of the selection
text.
Sourcepub fn optional_html(
&self,
selection: &str,
) -> Result<Option<String>, ScrapeError>
pub fn optional_html( &self, selection: &str, ) -> Result<Option<String>, ScrapeError>
Scrapes the optional instance of the selection
html.
Trait Implementations§
Source§impl<'a> From<ElementRef<'a>> for Scraper<'a>
impl<'a> From<ElementRef<'a>> for Scraper<'a>
Source§fn from(element: ElementRef<'a>) -> Self
fn from(element: ElementRef<'a>) -> Self
Converts to this type from the input type.
impl<'a> Copy for Scraper<'a>
Auto Trait Implementations§
impl<'a> Freeze for Scraper<'a>
impl<'a> !RefUnwindSafe for Scraper<'a>
impl<'a> !Send for Scraper<'a>
impl<'a> !Sync for Scraper<'a>
impl<'a> Unpin for Scraper<'a>
impl<'a> !UnwindSafe for Scraper<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more