#[repr(transparent)]pub struct AB<N = Vec<u8>>(pub N)
where
N: ?Sized;
Expand description
newtype around bytes to print/parse [[abe]] text
Tuple Fields§
§0: N
Implementations§
§impl<const L: usize> AB<[u8; L]>
impl<const L: usize> AB<[u8; L]>
pub fn utf8(&self) -> Result<&str, Utf8Error>
pub fn try_utf8(&self) -> Cow<'_, str>
pub fn try_utf8(&self) -> Cow<'_, str>
Self::utf8 but fallback to abtxt
pub const fn try_fit_byte_slice( slice: &[u8] ) -> Result<AB<[u8; L]>, FitSliceErr>
pub const fn try_fit_slice_filled<const FILL: u8>( slice: &[u8] ) -> Result<AB<[u8; L]>, FitSliceErr>
pub fn parse_abtxt(st: impl AsRef<[u8]>) -> Result<AB<[u8; L]>, ABTxtError>
Trait Implementations§
§impl<'de, N> Deserialize<'de> for AB<N>where
N: Deserialize<'de> + ?Sized,
impl<'de, N> Deserialize<'de> for AB<N>where N: Deserialize<'de> + ?Sized,
§fn deserialize<__D>(
__deserializer: __D
) -> Result<AB<N>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<AB<N>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<N> PartialOrd for AB<N>where
N: PartialOrd + ?Sized,
impl<N> PartialOrd for AB<N>where N: PartialOrd + ?Sized,
§fn partial_cmp(&self, other: &AB<N>) -> Option<Ordering>
fn partial_cmp(&self, other: &AB<N>) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl<N> Serialize for AB<N>where
N: Serialize + ?Sized,
impl<N> Serialize for AB<N>where N: Serialize + ?Sized,
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl UInt for AB<[u8; 16]>
impl UInt for AB<[u8; 16]>
const MIN: AB<[u8; 16]> = _
const MAX: AB<[u8; 16]> = _
const ONE: AB<[u8; 16]> = _
const BITS: u32 = 128u32
fn as_be_bytes(&self, out: &mut dyn FnMut(&[u8]))
fn bit_and(self, other: AB<[u8; 16]>) -> AB<[u8; 16]>
fn bit_or(self, other: AB<[u8; 16]>) -> AB<[u8; 16]>
fn not(self) -> AB<[u8; 16]>
fn inc(self) -> Option<AB<[u8; 16]>>
fn decr(self) -> Option<AB<[u8; 16]>>
fn overflowing_add(self, rhs: AB<[u8; 16]>) -> (AB<[u8; 16]>, bool)
fn checked_sub(self, other: AB<[u8; 16]>) -> Option<AB<[u8; 16]>>
fn checked_add(self, other: AB<[u8; 16]>) -> Option<AB<[u8; 16]>>
fn overflowing_shl(self, rhs: u32) -> (AB<[u8; 16]>, bool)
fn overflowing_shr(self, rhs: u32) -> (AB<[u8; 16]>, bool)
fn leading_zeros(&self) -> u32
fn trailing_zeros(&self) -> u32
fn trailing_ones(&self) -> u32
fn leading_ones(&self) -> u32
fn to_be_vec(&self) -> Vec<u8> ⓘ
impl<N> Copy for AB<N>where N: Copy + ?Sized,
impl<N> Eq for AB<N>where N: Eq + ?Sized,
impl<N> Pod for AB<N>where N: Pod + ?Sized,
impl<N> StructuralEq for AB<N>where N: ?Sized,
impl<N> StructuralPartialEq for AB<N>where N: ?Sized,
Auto Trait Implementations§
impl<N: ?Sized> RefUnwindSafe for AB<N>where N: RefUnwindSafe,
impl<N: ?Sized> Send for AB<N>where N: Send,
impl<N: ?Sized> Sync for AB<N>where N: Sync,
impl<N: ?Sized> Unpin for AB<N>where N: Unpin,
impl<N: ?Sized> UnwindSafe for AB<N>where N: UnwindSafe,
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
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.