pub enum WordLength {
FiveBits,
SixBits,
SevenBits,
EightBits,
}Expand description
The length of words for the transmission and reception in LCR.
This type is a convenient and non-ABI compatible abstraction. ABI
compatibility is given via WordLength::from_raw_bits and
WordLength::to_raw_bits.
Variants§
FiveBits
5-bit words.
SixBits
6-bit words.
SevenBits
7-bit words.
EightBits
8-bit words (recommended default).
Implementations§
Source§impl WordLength
impl WordLength
Sourcepub const fn from_raw_bits(bits: u8) -> Self
pub const fn from_raw_bits(bits: u8) -> Self
Translates the raw encoding into the corresponding value.
This function operates on the value as-is and does not perform any shifting bits.
Sourcepub const fn to_raw_bits(self) -> u8
pub const fn to_raw_bits(self) -> u8
Translates the value into the corresponding raw encoding.
This function operates on the value as-is and does not perform any shifting bits.
Sourcepub const fn from_integer(value: u8) -> Self
pub const fn from_integer(value: u8) -> Self
Try to create the type from an integer representation of the word length.
Falling back to Self::EightBits on invalid values.
Sourcepub const fn to_integer(self) -> u32
pub const fn to_integer(self) -> u32
Returns the value as corresponding integer.
Trait Implementations§
Source§impl Clone for WordLength
impl Clone for WordLength
Source§fn clone(&self) -> WordLength
fn clone(&self) -> WordLength
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for WordLength
Source§impl Debug for WordLength
impl Debug for WordLength
Source§impl Default for WordLength
impl Default for WordLength
Source§fn default() -> WordLength
fn default() -> WordLength
Returns the “default value” for a type. Read more
impl Eq for WordLength
Source§impl Hash for WordLength
impl Hash for WordLength
Source§impl Ord for WordLength
impl Ord for WordLength
Source§fn cmp(&self, other: &WordLength) -> Ordering
fn cmp(&self, other: &WordLength) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for WordLength
impl PartialEq for WordLength
Source§impl PartialOrd for WordLength
impl PartialOrd for WordLength
impl StructuralPartialEq for WordLength
Auto Trait Implementations§
impl Freeze for WordLength
impl RefUnwindSafe for WordLength
impl Send for WordLength
impl Sync for WordLength
impl Unpin for WordLength
impl UnsafeUnpin for WordLength
impl UnwindSafe for WordLength
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