pub struct ClientConfig { /* private fields */ }Expand description
How a client session is built.
Two settings, and they are different settings: the frame ceiling is a
property of the conversation — the same StdioConfig the source and the
sink are built from, so a client cannot be given one ceiling for what it
reads and another for what it writes — and the request timeout is a
property of the caller, who knows whether their tool is fast.
§Examples
use std::time::Duration;
use protocol_droid::adapters::primary::stdio::StdioConfig;
use protocol_droid::adapters::secondary::stdio::ClientConfig;
let config = ClientConfig::new(StdioConfig::default())
.with_request_timeout(Duration::from_secs(5));
assert_eq!(config.request_timeout(), Some(Duration::from_secs(5)));Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub const fn new(transport: StdioConfig) -> Self
pub const fn new(transport: StdioConfig) -> Self
The frame ceiling, and a thirty-second request deadline.
Sourcepub const fn with_request_timeout(self, timeout: Duration) -> Self
pub const fn with_request_timeout(self, timeout: Duration) -> Self
Replaces the request deadline.
Sourcepub const fn without_request_timeout(self) -> Self
pub const fn without_request_timeout(self) -> Self
Waits for a non-answer forever.
For a caller that has its own deadline and does not want two of them — a probe that must observe exactly how long a wedged server stays wedged, say. Everything else wants the default.
Sourcepub const fn transport(&self) -> StdioConfig
pub const fn transport(&self) -> StdioConfig
The settings the source and the sink are built from.
Sourcepub const fn request_timeout(&self) -> Option<Duration>
pub const fn request_timeout(&self) -> Option<Duration>
The request deadline, when there is one.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
impl Copy for ClientConfig
Source§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl Default for ClientConfig
impl Default for ClientConfig
Source§fn default() -> Self
fn default() -> Self
ClientConfig::new, which is the only implementation: there is no
other set of defaults to choose between.