Struct linkspace::prelude::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 AB<[u8; 2]>

pub fn uint(self) -> U16

§

impl AB<[u8; 4]>

pub fn uint(self) -> U32

§

impl AB<[u8; 8]>

pub fn uint(self) -> U64

§

impl AB<[u8; 16]>

pub fn uint(self) -> U128

§

impl<N> AB<N>where N: ?Sized,

pub fn from_ref(b: &N) -> &AB<N>

§

impl<N> AB<N>where AB<N>: AsRef<[u8]>,

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>

§

impl<'o> AB<&'o [u8]>

pub fn parse_scope<V>(&self) -> Result<V, ParseErr<<V as FromStr>::Err>>where V: FromStr, <V as FromStr>::Err: Error,

pub fn parse<V>(&self) -> Result<V, <V as FromStr>::Err>where V: FromStr,

§

impl<const L: usize> AB<[u8; L]>

pub fn utf8(&self) -> Result<&str, Utf8Error>

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>

§

impl AB<[u8; 16]>

pub const fn to_u128(self) -> u128

pub const fn from_u128(value: u128) -> AB<[u8; 16]>

Trait Implementations§

§

impl<const L: usize> ABEValidator for AB<[u8; L]>

§

fn check(b: &[ABE]) -> Result<(), MatchError>

§

impl<N> AsRef<[u8]> for AB<N>where N: AsRef<[u8]>,

§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<N> AsRef<N> for AB<N>

§

fn as_ref(&self) -> &N

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<N> Borrow<[u8]> for AB<N>where N: Borrow<[u8]>,

§

fn borrow(&self) -> &[u8]

Immutably borrows from an owned value. Read more
§

impl<N> Clone for AB<N>where N: Clone + ?Sized,

§

fn clone(&self) -> AB<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<X> Debug for AB<X>where AB<X>: AsRef<[u8]>,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<N> Default for AB<N>where N: Default + ?Sized,

§

fn default() -> AB<N>

Returns the “default value” for a type. Read more
§

impl<N> Deref for AB<N>

§

type Target = N

The resulting type after dereferencing.
§

fn deref(&self) -> &<AB<N> as Deref>::Target

Dereferences the value.
§

impl<N> DerefMut for AB<N>

§

fn deref_mut(&mut self) -> &mut <AB<N> as Deref>::Target

Mutably dereferences the value.
§

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>,

Deserialize this value from the given Serde deserializer. Read more
§

impl<X> Display for AB<X>where AB<X>: AsRef<[u8]>,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'o> From<&'o [u8]> for &'o AB<[u8]>

§

fn from(d: &'o [u8]) -> &'o AB<[u8]>

Converts to this type from the input type.
§

impl<N> From<N> for AB<N>

§

fn from(v: N) -> AB<N>

Converts to this type from the input type.
§

impl From<u128> for AB<[u8; 16]>

§

fn from(value: u128) -> AB<[u8; 16]>

Converts to this type from the input type.
§

impl FromStr for AB

§

type Err = ABTxtError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<AB, <AB as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl<const N: usize> FromStr for AB<[u8; N]>

§

type Err = ABTxtError

The associated error which can be returned from parsing.
§

fn from_str(s: &str) -> Result<AB<[u8; N]>, <AB<[u8; N]> as FromStr>::Err>

Parses a string s to return a value of this type. Read more
§

impl<N> Hash for AB<N>where N: Hash + ?Sized,

§

fn hash<__H>(&self, state: &mut __H)where __H: Hasher,

Feeds this value into the given Hasher. Read more
§

impl<N> Ord for AB<N>where N: Ord + ?Sized,

§

fn cmp(&self, other: &AB<N>) -> Ordering

This method returns an Ordering between self and other. Read more
§

impl<N> PartialEq for AB<N>where N: PartialEq + ?Sized,

§

fn eq(&self, other: &AB<N>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<N> PartialOrd for AB<N>where N: PartialOrd + ?Sized,

§

fn partial_cmp(&self, other: &AB<N>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater 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,

§

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<N> ToABE for AB<N>where AB<N>: AsRef<[u8]>,

§

fn write_abe(&self, out: &mut dyn FnMut(ABE))

§

fn to_abe_str(&self) -> String

§

fn to_abe(&self) -> Vec<ABE>

§

impl<const L: usize> TryFrom<&[u8]> for AB<[u8; L]>

§

type Error = FitSliceErr

The type returned in the event of a conversion error.
§

fn try_from( value: &[u8] ) -> Result<AB<[u8; L]>, <AB<[u8; L]> as TryFrom<&[u8]>>::Error>

Performs the conversion.
§

impl<const L: usize> TryFrom<ABList> for AB<[u8; L]>

§

type Error = FitSliceErr

The type returned in the event of a conversion error.
§

fn try_from( value: ABList ) -> Result<AB<[u8; L]>, <AB<[u8; L]> as TryFrom<ABList>>::Error>

Performs the conversion.
§

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> Zeroable for AB<N>where N: Zeroable + ?Sized,

§

fn zeroed() -> Self

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CheckedBitPattern for Twhere T: AnyBitPattern,

§

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

If this function returns true, then it must be valid to reinterpret bits as &Self.
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoResult<T> for T

§

type Err = Infallible

§

fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> AnyBitPattern for Twhere T: Pod,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,

§

impl<T> Formattable for Twhere T: Deref, <T as Deref>::Target: Formattable,

§

impl<T> NoUninit for Twhere T: Pod,

§

impl<T> Parsable for Twhere T: Deref, <T as Deref>::Target: Parsable,