pub struct ClientBuilder { /* private fields */ }Expand description
Builder for constructing a MesaClient with custom configuration.
§Example
use std::time::Duration;
use mesa_dev::ClientBuilder;
let client = ClientBuilder::new("my-api-key")
.base_url("https://custom.mesa.dev/api/v1")
.timeout(Duration::from_secs(60))
.max_retries(5)
.build();To use a custom HTTP backend, call build_with instead
of build.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn max_retries(self, n: u32) -> Self
pub fn max_retries(self, n: u32) -> Self
Set the maximum number of retries.
Sourcepub fn initial_backoff(self, d: Duration) -> Self
pub fn initial_backoff(self, d: Duration) -> Self
Set the initial backoff duration.
Sourcepub fn max_backoff(self, d: Duration) -> Self
pub fn max_backoff(self, d: Duration) -> Self
Set the maximum backoff duration.
Sourcepub fn default_header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn default_header(self, name: HeaderName, value: HeaderValue) -> Self
Add a default header to every request.
Sourcepub fn build(self) -> MesaClient<ReqwestClient>
pub fn build(self) -> MesaClient<ReqwestClient>
Build a MesaClient with the default reqwest backend.
Sourcepub fn build_with<C: HttpClient>(self, http_client: C) -> MesaClient<C>
pub fn build_with<C: HttpClient>(self, http_client: C) -> MesaClient<C>
Build a MesaClient with a custom HTTP client backend.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClientBuilder
impl RefUnwindSafe for ClientBuilder
impl Send for ClientBuilder
impl Sync for ClientBuilder
impl Unpin for ClientBuilder
impl UnwindSafe 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