pub struct ClientBuilder<T: Transport = DefaultTransport> { /* private fields */ }Expand description
Builder for configuring and creating a client.
The type parameter T selects the transport backend. When the
tcp-tokio feature is enabled (the default), T defaults to
ironsbe_transport::DefaultTransport so existing call-sites compile
without changes. With the feature disabled, T must be specified
explicitly so downstream crates can plug in a custom backend.
Implementations§
Source§impl<T: Transport> ClientBuilder<T>
impl<T: Transport> ClientBuilder<T>
Sourcepub fn new(server_addr: SocketAddr) -> Self
pub fn new(server_addr: SocketAddr) -> Self
Creates a new client builder for the specified server address.
Sourcepub fn connect_config(self, config: T::ConnectConfig) -> Self
pub fn connect_config(self, config: T::ConnectConfig) -> Self
Supplies a backend-specific connect configuration.
Use this to override transport tunables (frame size, NODELAY, socket buffer sizes, …). When unset, the backend builds a default config from the server address.
Sourcepub fn connect_timeout(self, timeout: Duration) -> Self
pub fn connect_timeout(self, timeout: Duration) -> Self
Sets the outer connection timeout used by the reconnect loop.
This bounds how long Client::run waits for a single connect
attempt before mapping the failure to ClientError::ConnectTimeout.
It does not mutate any connect_config
the user may have supplied — to also override the backend’s internal
connect timeout for the Tokio TCP backend, use
tcp_connect_timeout.
Sourcepub fn reconnect_delay(self, delay: Duration) -> Self
pub fn reconnect_delay(self, delay: Duration) -> Self
Sets the reconnection delay.
Sourcepub fn max_reconnect_attempts(self, max: usize) -> Self
pub fn max_reconnect_attempts(self, max: usize) -> Self
Sets the maximum reconnection attempts.
Sourcepub fn channel_capacity(self, capacity: usize) -> Self
pub fn channel_capacity(self, capacity: usize) -> Self
Sets the channel capacity.
Sourcepub fn build(self) -> (Client<T>, ClientHandle)
pub fn build(self) -> (Client<T>, ClientHandle)
Builds the client and handle.
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn with_default_transport(server_addr: SocketAddr) -> Self
pub fn with_default_transport(server_addr: SocketAddr) -> Self
Creates a new client builder using the default transport backend.
This is a convenience constructor that resolves the transport type
parameter to ironsbe_transport::DefaultTransport, keeping existing
call-sites like ClientBuilder::with_default_transport(addr).build()
working without turbofish syntax.
Sourcepub fn max_frame_size(self, size: usize) -> Self
pub fn max_frame_size(self, size: usize) -> Self
Sets the maximum SBE frame size in bytes (Tokio TCP backend only).
Convenience shortcut that mutates the underlying
ironsbe_transport::tcp::TcpClientConfig without requiring callers
to construct it manually.
Sourcepub fn tcp_connect_timeout(self, timeout: Duration) -> Self
pub fn tcp_connect_timeout(self, timeout: Duration) -> Self
Forwards a connect timeout into the underlying
TcpClientConfig so the
backend’s internal timeout matches the outer reconnect loop.
Convenience shortcut equivalent to calling
connect_timeout and then mutating
TcpClientConfig::connect_timeout on a custom connect_config.