#[non_exhaustive]pub struct ClientConfig {
pub request_timeout: Duration,
pub max_session_body: u64,
pub max_call_body: u64,
pub max_download_body: u64,
pub max_upload_body: u64,
pub max_sse_frame: usize,
}Expand description
Per-client configuration for timeouts and body size limits.
Use ClientConfig::default() for production defaults (30s timeout, RFC-safe caps).
This type is #[non_exhaustive]: callers outside this crate must use
..ClientConfig::default() when constructing it, allowing new fields to
be added in minor versions without breaking callers.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.request_timeout: DurationTimeout for HTTP request/response cycles (fetch_session, call, upload_blob, download_blob).
Does NOT apply to SSE or WebSocket streams (which are indefinite by nature).
Must be > 0. Use Duration::from_secs(30) for a 30-second timeout.
Default: 30 seconds.
max_session_body: u64Maximum response body for fetch_session. Default: 1 MiB.
max_call_body: u64Maximum response body for call(). Default: 8 MiB.
max_download_body: u64Maximum response body for download_blob(). Default: 64 MiB.
max_upload_body: u64Maximum response body for upload_blob() response parsing. Default: 1 MiB.
max_sse_frame: usizeMaximum byte length of a single SSE frame (raw bytes and decoded text). Protects against memory exhaustion from a hostile or misbehaving server that sends a single very large frame. Must be > 0. Default: 1 MiB.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn validate(&self) -> Result<(), ClientError>
pub fn validate(&self) -> Result<(), ClientError>
Validate that all config fields satisfy their constraints.
Called automatically by JmapClient::new. Callers may also call
this directly to pre-validate a config before passing it to the
constructor.
§Errors
Returns ClientError::InvalidArgument when any field is zero or
out-of-range.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl Default for ClientConfig
impl Default for ClientConfig
Source§impl PartialEq for ClientConfig
impl PartialEq for ClientConfig
impl Eq for ClientConfig
impl StructuralPartialEq for ClientConfig
Auto Trait Implementations§
impl Freeze for ClientConfig
impl RefUnwindSafe for ClientConfig
impl Send for ClientConfig
impl Sync for ClientConfig
impl Unpin for ClientConfig
impl UnsafeUnpin for ClientConfig
impl UnwindSafe for ClientConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.