pub struct SerialConfig {
pub baud_rate: u32,
pub data_bits: DataBits,
pub stop_bits: StopBits,
pub parity: Parity,
pub flow_control: FlowControl,
pub read_timeout: Duration,
}Expand description
Full serial-link configuration.
SerialConfig is what the CLI builds from command-line flags (see
rtcom-cli Issue #3) and what the session orchestrator hands to a
SerialDevice at open time. It is also what
SerialDevice::config returns so runtime
code can display or serialize the current link parameters.
Fields§
§baud_rate: u32Baud rate in bits per second.
data_bits: DataBitsData bits per frame.
stop_bits: StopBitsStop bits per frame.
parity: ParityParity mode.
flow_control: FlowControlFlow-control mode.
read_timeout: DurationTimeout used by blocking reads (unused on the async path, but kept so
config() remains a faithful record of the requested settings).
Implementations§
Source§impl SerialConfig
impl SerialConfig
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates that the configuration is internally consistent.
Currently only rejects a zero baud rate; more checks (e.g. disallowing
Mark/Space on platforms that don’t implement them) may be added in
the future.
§Errors
Returns Error::InvalidConfig if the
configuration cannot be used to open a device.
Trait Implementations§
Source§impl Clone for SerialConfig
impl Clone for SerialConfig
Source§fn clone(&self) -> SerialConfig
fn clone(&self) -> SerialConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more