#[non_exhaustive]pub struct ClientConfig {
pub url_policy: UrlPolicy,
pub timeout: Duration,
pub retry: RetryPolicy,
pub validate_outgoing: bool,
}client only.Expand description
How the client behaves.
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.url_policy: UrlPolicyWhat this client is willing to send a request to. Defaults to HTTPS, no private networks.
timeout: DurationHow long one request may take.
retry: RetryPolicyHow GET requests are retried. Writes are never retried.
validate_outgoing: boolWhether objects are validated before being sent. Defaults to true.
This is what makes “construct strictly” hold in practice: the infallible From<&str>
conversions the builders use are lenient, so the guarantee lives here, at the wire, where
it also catches the cross-field rules no constructor could.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn for_testing() -> Self
pub fn for_testing() -> Self
A configuration for talking to a peer on localhost, as an integration test does.
Sourcepub fn with_url_policy(self, policy: UrlPolicy) -> Self
pub fn with_url_policy(self, policy: UrlPolicy) -> Self
Sets the URL policy.
Sourcepub const fn with_timeout(self, timeout: Duration) -> Self
pub const fn with_timeout(self, timeout: Duration) -> Self
Sets the per-request timeout.
Sourcepub const fn without_outgoing_validation(self) -> Self
pub const fn without_outgoing_validation(self) -> Self
Turns off validation of outgoing objects.
Only reasonable when a peer is known to require something non-conformant, and then it is better to record the reason next to the call.
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