pub struct ClientBuilder { /* private fields */ }Expand description
Builder for Client.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
pub fn new() -> Self
pub fn base_url(self, base_url: impl AsRef<str>) -> Result<Self>
pub fn timeout(self, timeout: Duration) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
pub fn auth(self, auth: Auth) -> Self
pub fn default_header( self, key: impl AsRef<str>, value: impl AsRef<str>, ) -> Result<Self>
pub fn hooks(self, hooks: Hooks) -> Self
pub fn plugin<P: Plugin + 'static>(self, plugin: P) -> Self
pub fn reqwest_client(self, client: ReqwestClient) -> Self
Sourcepub fn backend(self, backend: Arc<dyn HttpBackend>) -> Self
pub fn backend(self, backend: Arc<dyn HttpBackend>) -> Self
Use a custom HTTP backend (for testing or alternate transports).
Sourcepub fn max_in_flight(self, limit: usize) -> Self
pub fn max_in_flight(self, limit: usize) -> Self
Limits how many requests this client may have in flight at once (including retries).
Implemented with a tokio semaphore in the core client. This counts the full request
lifecycle (hooks and retries), not just the transport hop. For wire-level limits only,
use [Self::transport_stack] with Tower’s ConcurrencyLimitLayer
(feature tower) instead of—or deliberately alongside—this setting.
Sourcepub fn json_parser<F>(self, f: F) -> Self
pub fn json_parser<F>(self, f: F) -> Self
Sets a custom JSON parser for all responses from this client.
Sourcepub fn json_parser_fn(self, parser: JsonParserFn) -> Self
pub fn json_parser_fn(self, parser: JsonParserFn) -> Self
Sets a custom JSON parser from an existing JsonParserFn.
pub fn build(self) -> Result<Client>
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 UnsafeUnpin 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