#[repr(C)]pub struct BitField(/* private fields */);
Expand description
Helper newtype to represent a packed bitfield structure.
Implementations§
source§impl BitField
impl BitField
Configuration of various translation/usability options for the serial port device.
Option | Effect |
---|---|
flush_on_eol | Automatically flush when an end-of-line is transmitted |
cr_to_crlf | Translate sent CRs to CRLF |
lf_to_crlf | Translate sent LFs to CRLF |
interactive | This is an interactive terminal, reading from the device will automatically flush the transmit buffer first |
echo | Echo all characters received back on the transmit line. If interactive is set, will also flush after each. |
blocking_read | Calls to read() should block until data is available |
read_to_eol | Blocking read()s will immediately return when a CR or LF (‘\r’ or ‘\n’) is received |
read_to_eot | Blocking read()s will immediately return when an EOT character is received |
sourcepub fn set_flush_on_eol(&mut self, flag: bool)
pub fn set_flush_on_eol(&mut self, flag: bool)
Indicate that the device should automatically flush when an end-of-line (CR or LF) character is sent is sent.
sourcepub fn flush_on_eol(self) -> bool
pub fn flush_on_eol(self) -> bool
True iff the device should automatically flush when an LF character is sent.
sourcepub fn set_cr_to_crlf(&mut self, flag: bool)
pub fn set_cr_to_crlf(&mut self, flag: bool)
Indicate that CR should be translated to CRLF automatically
sourcepub fn cr_to_crlf(&self) -> bool
pub fn cr_to_crlf(&self) -> bool
True iff the device should automatically translate CR to CRLF.
sourcepub fn set_lf_to_crlf(&mut self, flag: bool)
pub fn set_lf_to_crlf(&mut self, flag: bool)
Indicate that LF should be translated to CRLF automatically
sourcepub fn lf_to_crlf(&self) -> bool
pub fn lf_to_crlf(&self) -> bool
True iff the device should automatically translate LF to CRLF.
sourcepub fn set_interactive(&mut self, flag: bool)
pub fn set_interactive(&mut self, flag: bool)
Indicate that this is an interactive terminal. Effects:
- A call to read() will automatically flush the transmit buffer
sourcepub fn interactive(&self) -> bool
pub fn interactive(&self) -> bool
True iff this is an interative terminal
sourcepub fn set_echo(&mut self, flag: bool)
pub fn set_echo(&mut self, flag: bool)
Indicate that we should echo received characters back.
If the device is also set to interactive
, then we will flush() after
each echoed character as well.
sourcepub fn set_blocking_read(&mut self, flag: bool)
pub fn set_blocking_read(&mut self, flag: bool)
Indicate that calls to read() should block until data is available
sourcepub fn blocking_read(&self) -> bool
pub fn blocking_read(&self) -> bool
True iff read()s should block until data is available
sourcepub fn set_read_to_eol(&mut self, flag: bool)
pub fn set_read_to_eol(&mut self, flag: bool)
Stop blocking read()s as soon as a linefeed (\n) is received
sourcepub fn read_to_eol(&self) -> bool
pub fn read_to_eol(&self) -> bool
True iff blocking reads will complete when a linefeed (\n) is received
sourcepub fn set_read_to_eot(&mut self, flag: bool)
pub fn set_read_to_eot(&mut self, flag: bool)
Stop blocking read()s as soon as an EOT is received
sourcepub fn read_to_eot(&self) -> bool
pub fn read_to_eot(&self) -> bool
True iff blocking reads will complete when an EOT is received
sourcepub fn disable_translations(&mut self)
pub fn disable_translations(&mut self)
Clear all settings that result in the data being translated in any way (e.g. CR to CRLF type translations.) Use this to ensure a serial port is ‘clean’ for sending/receiving binary data.
source§impl BitField
impl BitField
sourcepub const fn with_initial(vals: u8) -> Self
pub const fn with_initial(vals: u8) -> Self
Create a BitField initialised to the given values (big-endian)
sourcepub fn with_bits_set(bits: &[BitIndex]) -> Self
pub fn with_bits_set(bits: &[BitIndex]) -> Self
Create a BitField where all bits are clear except the ones passed in the initialisation array.
Trait Implementations§
source§impl BitFieldAccess for BitField
impl BitFieldAccess for BitField
fn read_byte(&self) -> u8
fn write_byte(&mut self, val: u8)
source§fn is_all_set<B: BitMaskable + Copy>(&self, bits: B) -> bool
fn is_all_set<B: BitMaskable + Copy>(&self, bits: B) -> bool
source§fn is_any_set<B: BitMaskable + Copy>(&self, bits: B) -> bool
fn is_any_set<B: BitMaskable + Copy>(&self, bits: B) -> bool
source§fn is_all_clr<B: BitMaskable + Copy>(&self, bits: B) -> bool
fn is_all_clr<B: BitMaskable + Copy>(&self, bits: B) -> bool
source§fn set_isolated<B: BitMaskable + Copy>(&mut self, _isotoken: Isolated, bits: B)
fn set_isolated<B: BitMaskable + Copy>(&mut self, _isotoken: Isolated, bits: B)
source§fn set<B: BitMaskable + Copy>(&mut self, bits: B)
fn set<B: BitMaskable + Copy>(&mut self, bits: B)
source§fn exc_set<B: BitMaskable + Copy>(&mut self, bits: B)
fn exc_set<B: BitMaskable + Copy>(&mut self, bits: B)
source§fn clr_isolated<B: BitMaskable + Copy>(&mut self, _isotoken: Isolated, bits: B)
fn clr_isolated<B: BitMaskable + Copy>(&mut self, _isotoken: Isolated, bits: B)
source§fn clr<B: BitMaskable + Copy>(&mut self, bits: B)
fn clr<B: BitMaskable + Copy>(&mut self, bits: B)
source§fn exc_clr<B: BitMaskable + Copy>(&mut self, bits: B)
fn exc_clr<B: BitMaskable + Copy>(&mut self, bits: B)
source§fn set_or_clr<B: BitMaskable + Copy>(&mut self, bits: B, set: bool)
fn set_or_clr<B: BitMaskable + Copy>(&mut self, bits: B, set: bool)
set
parameter (true = set the bit, false = clear it.)