Trait nibble::base::u4
[−]
[src]
pub trait u4: Debug + Display + Binary + Octal + LowerHex + UpperHex + PartialEq<u4lo> + PartialEq<u4hi> + PartialOrd<u4lo> + PartialOrd<u4hi> { fn from_hi(lo_and_hi: u8) -> Self
where
Self: Sized; fn from_lo(lo_and_hi: u8) -> Self
where
Self: Sized; fn from_repeated(lo_and_hi: u8) -> Self
where
Self: Sized; fn to_hi(&self) -> u8; fn to_lo(&self) -> u8; fn try_from_hi(lo_and_hi: u8) -> Option<Self>
where
Self: Sized, { ... } fn try_from_lo(lo_and_hi: u8) -> Option<Self>
where
Self: Sized, { ... } fn to_repeated(&self) -> u8 { ... } fn to_u4hi(&self) -> u4hi { ... } fn to_u4lo(&self) -> u4lo { ... } fn from_ascii_digit(b: u8) -> Option<Self>
where
Self: Sized, { ... } fn to_lower_ascii_digit(&self) -> u8 { ... } fn to_upper_ascii_digit(&self) -> u8 { ... } fn from_digit(c: char) -> Option<Self>
where
Self: Sized, { ... } fn to_lower_digit(&self) -> char { ... } fn to_upper_digit(&self) -> char { ... } fn to_lower_hex(&self) -> ArrayString<[u8; 1]> { ... } fn to_upper_hex(&self) -> ArrayString<[u8; 1]> { ... } fn from_ascii_binary(s: ArrayVec<[u8; 4]>) -> Option<Self>
where
Self: Sized, { ... } fn from_binary(s: ArrayString<[u8; 4]>) -> Option<Self>
where
Self: Sized, { ... } fn to_padded_binary(&self) -> ArrayString<[u8; 4]> { ... } fn to_binary(&self) -> ArrayString<[u8; 4]> { ... } fn to_octal(&self) -> ArrayString<[u8; 2]> { ... } fn to_decimal(&self) -> ArrayString<[u8; 2]> { ... } fn from_ascii_radix(s: &[u8], radix: u32) -> Result<Self, ParseNibbleError>
where
Self: Sized, { ... } fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseNibbleError>
where
Self: Sized, { ... } }
A nibble.
Required Methods
fn from_hi(lo_and_hi: u8) -> Self where
Self: Sized,
Self: Sized,
Constructs a nibble from the high-order bits the a given byte.
fn from_lo(lo_and_hi: u8) -> Self where
Self: Sized,
Self: Sized,
Constructs a nibble from the low-order bits the a given byte.
fn from_repeated(lo_and_hi: u8) -> Self where
Self: Sized,
Self: Sized,
Constructs a nibble from a byte with the same data in the high- and low-order bits.
fn to_hi(&self) -> u8
Converts this nibble into a byte with its high-order bits set and low-order bits zero.
fn to_lo(&self) -> u8
Converts this nibble into a byte with its low-order bits set and high-order bits zero.
Provided Methods
fn try_from_hi(lo_and_hi: u8) -> Option<Self> where
Self: Sized,
Self: Sized,
Tries to constructs a nibble from the high-order bits the a given byte.
Fails if the low-order bits are nonzero.
fn try_from_lo(lo_and_hi: u8) -> Option<Self> where
Self: Sized,
Self: Sized,
Tries to constructs a nibble from the low-order bits the a given byte.
Fails if the high-order bits are nonzero.
fn to_repeated(&self) -> u8
Converts this nibble into a byte with the same data in the high- and low-order bits.
fn to_u4hi(&self) -> u4hi
Converts this nibble into a high-order version.
fn to_u4lo(&self) -> u4lo
Converts this nibble into a low-order version.
fn from_ascii_digit(b: u8) -> Option<Self> where
Self: Sized,
Self: Sized,
Converts an ASCII hex digit into a nibble.
fn to_lower_ascii_digit(&self) -> u8
Converts a nibble into a lowercase ASCII hex digit.
fn to_upper_ascii_digit(&self) -> u8
Converts a nibble into an uppercase ASCII hex digit.
fn from_digit(c: char) -> Option<Self> where
Self: Sized,
Self: Sized,
Converts a hex digit into a nibble.
fn to_lower_digit(&self) -> char
Converts a nibble into a lowercase hex digit.
fn to_upper_digit(&self) -> char
Converts a nibble into an uppercase hex digit.
fn to_lower_hex(&self) -> ArrayString<[u8; 1]>
Converts a nibble into a lowercase hex string.
fn to_upper_hex(&self) -> ArrayString<[u8; 1]>
Converts a nibble into an uppercase hex string.
fn from_ascii_binary(s: ArrayVec<[u8; 4]>) -> Option<Self> where
Self: Sized,
Self: Sized,
Converts an ASCII binary string into a nibble.
fn from_binary(s: ArrayString<[u8; 4]>) -> Option<Self> where
Self: Sized,
Self: Sized,
Converts an ASCII binary string into a nibble.
fn to_padded_binary(&self) -> ArrayString<[u8; 4]>
Converts a nibble into a 4-digit binary string.
fn to_binary(&self) -> ArrayString<[u8; 4]>
Converts a nibble into a binary string.
fn to_octal(&self) -> ArrayString<[u8; 2]>
Converts a nibble into an octal string.
fn to_decimal(&self) -> ArrayString<[u8; 2]>
Converts a nibble into a decimal string.
fn from_ascii_radix(s: &[u8], radix: u32) -> Result<Self, ParseNibbleError> where
Self: Sized,
Self: Sized,
fn from_str_radix(s: &str, radix: u32) -> Result<Self, ParseNibbleError> where
Self: Sized,
Self: Sized,