Struct stm32f3xx_hal::serial::config::Config[][src]

#[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

Sets the given baudrate.

Sets the given parity.

Sets the stop bits to stopbits.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates a new configuration with typically used parameters: 115,200 Baud 8N1.

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.