pub struct SerialConfig {
pub baud_rate: u32,
pub data_bits: DataBits,
pub parity: Parity,
pub stop_bits: StopBits,
pub flow_control: bool,
}Expand description
Serial port configuration.
Fields§
§baud_rate: u32Baud rate (bits per second).
data_bits: DataBitsData bits per character.
parity: ParityParity setting.
stop_bits: StopBitsStop bits.
flow_control: boolEnable hardware flow control (RTS/CTS).
Implementations§
Source§impl SerialConfig
impl SerialConfig
Sourcepub fn baud_19200() -> Self
pub fn baud_19200() -> Self
Common configuration: 19200/8N1.
Sourcepub fn baud_38400() -> Self
pub fn baud_38400() -> Self
Common configuration: 38400/8N1.
Sourcepub fn baud_115200() -> Self
pub fn baud_115200() -> Self
Common configuration: 115200/8N1.
Sourcepub fn with_parity(self, parity: Parity) -> Self
pub fn with_parity(self, parity: Parity) -> Self
Set parity.
Sourcepub fn with_stop_bits(self, stop_bits: StopBits) -> Self
pub fn with_stop_bits(self, stop_bits: StopBits) -> Self
Set stop bits.
Sourcepub fn with_data_bits(self, data_bits: DataBits) -> Self
pub fn with_data_bits(self, data_bits: DataBits) -> Self
Set data bits.
Sourcepub fn bits_per_character(&self) -> f32
pub fn bits_per_character(&self) -> f32
Calculate bits per character (start + data + parity + stop).
Sourcepub fn transmission_time(&self, bytes: usize) -> Duration
pub fn transmission_time(&self, bytes: usize) -> Duration
Calculate transmission time for a given number of bytes.
Sourcepub fn inter_frame_timeout(&self) -> Duration
pub fn inter_frame_timeout(&self) -> Duration
Calculate inter-frame timeout (3.5 character times).
Sourcepub fn inter_char_timeout(&self) -> Duration
pub fn inter_char_timeout(&self) -> Duration
Calculate inter-character timeout (1.5 character times).
Trait Implementations§
Source§impl Clone for SerialConfig
impl Clone for SerialConfig
Source§fn clone(&self) -> SerialConfig
fn clone(&self) -> SerialConfig
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 SerialConfig
impl Debug for SerialConfig
Source§impl Default for SerialConfig
impl Default for SerialConfig
Source§impl<'de> Deserialize<'de> for SerialConfig
impl<'de> Deserialize<'de> for SerialConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SerialConfig
impl RefUnwindSafe for SerialConfig
impl Send for SerialConfig
impl Sync for SerialConfig
impl Unpin for SerialConfig
impl UnsafeUnpin for SerialConfig
impl UnwindSafe for SerialConfig
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