Skip to main content

ModbusSerialConfig

Struct ModbusSerialConfig 

Source
pub struct ModbusSerialConfig<const PORT_PATH_LEN: usize = 64> {
    pub port_path: String<PORT_PATH_LEN>,
    pub mode: SerialMode,
    pub baud_rate: BaudRate,
    pub data_bits: DataBits,
    pub stop_bits: u8,
    pub parity: Parity,
    pub response_timeout_ms: u32,
    pub retry_attempts: u8,
    pub retry_backoff_strategy: BackoffStrategy,
    pub retry_jitter_strategy: JitterStrategy,
    pub retry_random_fn: Option<RetryRandomFn>,
}
Expand description

Configuration parameters for establishing a Modbus Serial connection.

Fields§

§port_path: String<PORT_PATH_LEN>

The path to the serial port (e.g., “/dev/ttyUSB0” or “COM1”).

§mode: SerialMode

The serial mode to use (RTU or ASCII).

§baud_rate: BaudRate

Communication speed in bits per second (e.g., 9600, 115200).

§data_bits: DataBits

Number of data bits per character (typically DataBits::Eight for RTU, DataBits::Seven for ASCII).

§stop_bits: u8

Number of stop bits (This will be recalculated before calling the transport layer).

§parity: Parity

The parity checking mode.

§response_timeout_ms: u32

Timeout for waiting for a response in milliseconds.

§retry_attempts: u8

Number of retries for failed operations.

§retry_backoff_strategy: BackoffStrategy

Backoff strategy used when scheduling retries.

§retry_jitter_strategy: JitterStrategy

Optional jitter strategy applied on top of retry backoff delay.

§retry_random_fn: Option<RetryRandomFn>

Optional application-provided random callback used by jitter.

Trait Implementations§

Source§

impl<const PORT_PATH_LEN: usize> Debug for ModbusSerialConfig<PORT_PATH_LEN>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const PORT_PATH_LEN: usize> Freeze for ModbusSerialConfig<PORT_PATH_LEN>

§

impl<const PORT_PATH_LEN: usize> RefUnwindSafe for ModbusSerialConfig<PORT_PATH_LEN>

§

impl<const PORT_PATH_LEN: usize> Send for ModbusSerialConfig<PORT_PATH_LEN>

§

impl<const PORT_PATH_LEN: usize> Sync for ModbusSerialConfig<PORT_PATH_LEN>

§

impl<const PORT_PATH_LEN: usize> Unpin for ModbusSerialConfig<PORT_PATH_LEN>

§

impl<const PORT_PATH_LEN: usize> UnsafeUnpin for ModbusSerialConfig<PORT_PATH_LEN>

§

impl<const PORT_PATH_LEN: usize> UnwindSafe for ModbusSerialConfig<PORT_PATH_LEN>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.