pub struct ClientConfig {
pub base_url: Url,
pub timeout: Option<Duration>,
pub retry: Option<RetryPolicy>,
pub auth: Option<Auth>,
pub default_headers: HeaderMap,
pub plugins: Arc<PluginRegistry>,
pub max_in_flight: Option<Arc<Semaphore>>,
pub schema_registry: Option<Arc<SchemaRegistry>>,
pub json_parser: Option<JsonParserFn>,
pub max_response_bytes: Option<u64>,
pub retry_body_peek_bytes: u64,
/* private fields */
}Expand description
Shared client configuration (returned by Client::config).
Fields§
§base_url: UrlBase URL joined with request paths.
timeout: Option<Duration>Default per-request timeout when the builder does not override it.
retry: Option<RetryPolicy>Default retry policy for requests that do not set their own.
auth: Option<Auth>Default authentication applied when a request has no per-request auth.
default_headers: HeaderMapHeaders merged into every request unless overridden.
plugins: Arc<PluginRegistry>Registered plugins (init hooks + merged hook chains).
max_in_flight: Option<Arc<Semaphore>>Limits concurrent in-flight requests for this client (including retries).
This is separate from Tower’s ConcurrencyLimitLayer:
the client semaphore applies to the full request lifecycle (hooks + retries), while Tower
limits only transport-layer concurrency. Avoid stacking both without accounting for that.
schema_registry: Option<Arc<SchemaRegistry>>schema only.Optional strict route registry (feature schema).
json_parser: Option<JsonParserFn>json only.Client-wide custom JSON parser (feature json).
max_response_bytes: Option<u64>Default maximum response body size for buffered and streaming responses.
retry_body_peek_bytes: u64Maximum bytes read from a streaming body when evaluating a custom retry predicate.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn effective_hooks(&self) -> &Hooks
pub fn effective_hooks(&self) -> &Hooks
Hooks executed at runtime (client hooks merged with plugin hooks when the client was built).
This is the chain used for on_request, on_response, and related hooks. The separate
hooks field on ClientConfig is the client-only configuration snapshot and is not
consulted during requests.
§Examples
let client = Client::new("https://api.example.com")?;
let _hooks = client.config().effective_hooks();Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more