#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct ControlModeFlagSettings
{
pub bits_per_byte: Option<BitsPerByte>,
pub stop_bits: Option<StopBits>,
pub parity: Option<Parity>,
pub miscellaneous: MiscellaneousControlModeFlagSettings,
}
impl Default for ControlModeFlagSettings
{
#[inline(always)]
fn default() -> Self
{
Self
{
bits_per_byte: Some(BitsPerByte::default()),
stop_bits: Some(StopBits::default()),
parity: Some(Parity::default()),
miscellaneous: MiscellaneousControlModeFlagSettings::default(),
}
}
}
impl ControlModeFlagSettings
{
#[inline(always)]
pub(crate) fn change_mode_flags(&self, terminal_options: &mut termios)
{
let existing_flags = terminal_options.c_cflag;
let mut new_flags = existing_flags;
new_flags = MultipleBits::change_mode_flags(self.bits_per_byte, new_flags);
new_flags = MultipleBits::change_mode_flags(self.stop_bits, new_flags);
new_flags = MultipleBits::change_mode_flags(self.parity, new_flags);
new_flags = self.miscellaneous.change_mode_flags(new_flags);
terminal_options.c_cflag = new_flags;
}
}