pub struct ClientConfig {
pub response_timeout: Duration,
pub retry_count: u8,
pub throttle_delay: Option<Duration>,
pub retry_policy: RetryPolicy,
}Expand description
Configuration for a ModbusClient.
Use the builder methods to customise, or rely on Default which provides
a 5-second timeout, 3 retries (read-only), and no throttle delay.
Fields§
§response_timeout: DurationMaximum time to wait for a response before returning ClientError::Timeout.
retry_count: u8Number of additional attempts after the first failure (0 = no retries).
throttle_delay: Option<Duration>Minimum delay between consecutive requests (useful for slow devices).
retry_policy: RetryPolicyWhich request types are eligible for automatic retry.
Implementations§
Source§impl ClientConfig
impl ClientConfig
Sourcepub fn with_response_timeout(self, timeout: Duration) -> Self
pub fn with_response_timeout(self, timeout: Duration) -> Self
Set the maximum time to wait for a Modbus response.
Sourcepub fn with_retry_count(self, retry_count: u8) -> Self
pub fn with_retry_count(self, retry_count: u8) -> Self
Set the number of retry attempts after the initial request fails.
Sourcepub fn with_throttle_delay(self, throttle_delay: Option<Duration>) -> Self
pub fn with_throttle_delay(self, throttle_delay: Option<Duration>) -> Self
Set the minimum inter-request delay (throttle).
Sourcepub fn with_retry_policy(self, retry_policy: RetryPolicy) -> Self
pub fn with_retry_policy(self, retry_policy: RetryPolicy) -> Self
Set the retry policy controlling which requests may be retried.
Trait Implementations§
Source§impl Clone for ClientConfig
impl Clone for ClientConfig
Source§fn clone(&self) -> ClientConfig
fn clone(&self) -> ClientConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ClientConfig
impl Debug for ClientConfig
Source§impl Default for ClientConfig
impl Default for ClientConfig
impl Copy 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
Mutably borrows from an owned value. Read more