pub struct ClientBuilder { /* private fields */ }Expand description
Builder for Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
The API base URL (default https://api.truto.one).
Sourcepub fn max_retries(self, n: u32) -> Self
pub fn max_retries(self, n: u32) -> Self
Maximum retries after the first attempt (default 3).
Sourcepub fn default_retry_after(self, wait: Duration) -> Self
pub fn default_retry_after(self, wait: Duration) -> Self
Wait after a 429 that has no usable Retry-After header (default 10s).
Sourcepub fn http_client(self, http: Client) -> Self
pub fn http_client(self, http: Client) -> Self
Use your own reqwest::Client (proxies, custom TLS, …).
Sourcepub fn on_retry(
self,
hook: impl Fn(u32, Option<u16>) + Send + Sync + 'static,
) -> Self
pub fn on_retry( self, hook: impl Fn(u32, Option<u16>) + Send + Sync + 'static, ) -> Self
Called before every retry with (retry_count, status).
Trait Implementations§
Source§impl Debug for ClientBuilder
impl Debug for ClientBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for ClientBuilder
impl !UnwindSafe for ClientBuilder
impl Freeze for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnsafeUnpin for ClientBuilder
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