pub struct Fetcher { /* private fields */ }Available on crate features
scraper and reqwest only.Expand description
Fetcher wrapper around a reusable reqwest::Client.
Provides an ergonomic, one-stop API for fetching a table (or table list) from a web URL.
Implementations§
Source§impl Fetcher
impl Fetcher
Sourcepub const fn new(client: Client) -> Self
pub const fn new(client: Client) -> Self
Create a fetcher from an existing reqwest::Client.
Sourcepub fn lenient() -> Result<Self>
pub fn lenient() -> Result<Self>
Create a fetcher with a more compatible, browser-like HTTP client configuration.
§Errors
Returns an error if building the underlying HTTP client fails.
Sourcepub const fn client(&self) -> &Client
pub const fn client(&self) -> &Client
Borrow the underlying reqwest::Client.
Sourcepub async fn fetch_table(&self, web_url: impl IntoUrl) -> Result<FetchedTable>
pub async fn fetch_table(&self, web_url: impl IntoUrl) -> Result<FetchedTable>
Fetch and parse a complete BMS difficulty table.
§Errors
Returns an error if fetching or parsing the table fails.
Sourcepub async fn fetch_table_list(
&self,
web_url: impl IntoUrl,
) -> Result<FetchedTableList>
pub async fn fetch_table_list( &self, web_url: impl IntoUrl, ) -> Result<FetchedTableList>
Fetch a list of BMS difficulty tables.
§Errors
Returns an error if fetching or parsing the list fails.
Trait Implementations§
Source§impl TableFetcher for Fetcher
impl TableFetcher for Fetcher
Source§async fn fetch_table(&self, web_url: Url) -> Result<FetchedTable>
async fn fetch_table(&self, web_url: Url) -> Result<FetchedTable>
Fetch and parse a complete BMS difficulty table, including raw JSON strings. Read more
Source§async fn fetch_table_list(&self, web_url: Url) -> Result<FetchedTableList>
async fn fetch_table_list(&self, web_url: Url) -> Result<FetchedTableList>
Fetch a list of BMS difficulty tables, including the raw JSON string. Read more
Auto Trait Implementations§
impl Freeze for Fetcher
impl !RefUnwindSafe for Fetcher
impl Send for Fetcher
impl Sync for Fetcher
impl Unpin for Fetcher
impl !UnwindSafe for Fetcher
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