#[non_exhaustive]pub struct Config {
pub baudrate: Baud,
pub parity: Parity,
pub stopbits: StopBits,
}
Expand description
Configuration struct for Serial
providing all
communication-related / parameters. Serial
always uses eight data
bits plus the parity bit - if selected.
Create a configuration by using default
in combination with the
builder methods. The following snippet shows creating a configuration
for 19,200 Baud, 8N1 by deriving it from the default value:
let config = Config::default().baudrate(19_200.Bd());
assert!(config.baudrate == 19_200.Bd());
assert!(config.parity == Parity::None);
assert!(config.stopbits == StopBits::STOP1);
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.baudrate: Baud
Serial interface baud rate
parity: Parity
Whether and how to generate/check a parity bit
stopbits: StopBits
The number of stop bits to follow the last data bit or the parity bit
Implementations§
Trait Implementations§
impl Copy for Config
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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