Struct AB
#[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<N> AB<N>
impl<N> AB<N>
pub fn cut_prefix_nulls(&self) -> &[u8] ⓘ
pub fn as_ref_cut(&self, cut_nulls: bool) -> &[u8] ⓘ
pub fn as_str(&self, cut_nulls: bool) -> Cow<'_, str>
pub fn x_prefix_cut(&self) -> (bool, &[u8])
§impl<const L: usize> AB<[u8; L]>
impl<const L: usize> AB<[u8; L]>
pub fn try_from_exact(slice: &[u8]) -> Result<AB<[u8; L]>, MatchErrorKind>
pub fn slice_into_bytes(slice: &[AB<[u8; L]>]) -> &[u8] ⓘ
pub fn slice_from_bytes( slice: &[u8], ) -> Result<&[AB<[u8; L]>], (&[AB<[u8; L]>], &[u8])>
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>
pub const fn try_join(
head: &[u8],
tail: &[u8],
) -> Result<AB<[u8; L]>, FitSliceErr>
pub const fn try_join( head: &[u8], tail: &[u8], ) -> Result<AB<[u8; L]>, FitSliceErr>
Join head and tail with padding between
pub fn split<const H: usize, const T: usize>(self) -> ([u8; H], [u8; T])
Trait Implementations§
§impl<'de> Deserialize<'de> for AB
impl<'de> Deserialize<'de> for AB
§fn deserialize<D>(
deserializer: D,
) -> Result<AB, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<AB, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<'de, const N: usize> Deserialize<'de> for AB<[u8; N]>
impl<'de, const N: usize> Deserialize<'de> for AB<[u8; N]>
§fn deserialize<D>(
deserializer: D,
) -> Result<AB<[u8; N]>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<AB<[u8; N]>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<N> Ord for AB<N>
impl<N> Ord for AB<N>
§impl<N> PartialOrd for AB<N>where
N: PartialOrd + ?Sized,
impl<N> PartialOrd for AB<N>where
N: PartialOrd + ?Sized,
§impl<B> Serialize for AB<B>
impl<B> Serialize for AB<B>
§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
const BYTE_SIZE: usize = 16usize
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>
impl<N> Eq for AB<N>
impl<N> StructuralPartialEq for AB<N>where
N: ?Sized,
Auto Trait Implementations§
impl<N> Freeze for AB<N>
impl<N> RefUnwindSafe for AB<N>where
N: RefUnwindSafe + ?Sized,
impl<N> Send for AB<N>
impl<N> Sync for AB<N>
impl<N> Unpin for AB<N>
impl<N> UnwindSafe for AB<N>where
N: UnwindSafe + ?Sized,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more