Added impl Default for UartConfig

This commit is contained in:
Victor Koenders 2022-01-18 11:17:01 +01:00
parent bae3f2c9bc
commit 9e75cec551
No known key found for this signature in database
GPG key ID: 2E441540865B8A1C

View file

@ -59,6 +59,16 @@ pub enum Parity {
}
/// A struct holding the configuration for an UART device.
///
/// The `Default` implementation implements the following values:
/// ```
/// UartConfig {
/// baudrate: Baud(0),
/// data_bits: DataBits::Eight,
/// stop_bits: StopBits::One,
/// parity: None,
///}
/// ```
#[non_exhaustive]
pub struct UartConfig {
/// The baudrate the uart will run at.
@ -74,6 +84,17 @@ pub struct UartConfig {
pub parity: Option<Parity>,
}
impl Default for UartConfig {
fn default() -> Self {
Self {
baudrate: Baud(0),
data_bits: DataBits::Eight,
stop_bits: StopBits::One,
parity: None,
}
}
}
/// Same as core::convert::Infallible, but implementing serial::Error
///
/// For eh 1.0.0-alpha.6, Infallible doesn't implement serial::Error,