Handle some basic options in WebClient::default

This commit is contained in:
2022-06-02 08:15:40 +00:00
committed by GitHub
parent b9704e16ca
commit 36658a3753
3 changed files with 11 additions and 8 deletions

View File

@@ -103,6 +103,8 @@ pub struct WebClient {
impl WebClient {
/// Create a new instance of client
///
/// This function will not handle any basic options, please use [Self::default()] instead.
pub fn new() -> Self {
Self {
client: Client::new(),
@@ -620,6 +622,13 @@ impl WebClient {
impl Default for WebClient {
fn default() -> Self {
let c = Self::new();
let opt = get_helper();
c.set_verbose(opt.verbose());
match opt.retry() {
Some(retry) => { c.set_retry(retry) }
None => {}
}
c.get_retry_interval_as_mut().replace(opt.retry_interval());
c
}
}