Struct byte_fmt::B64

source ·
#[repr(transparent)]
pub struct B64<N = [u8; 32]>(pub N);
Expand description

newtype around bytes to print/parse b64 (url-safe no-padding)

Tuple Fields§

§0: N

Implementations§

source§

impl<N> B64<N>

source

pub fn into_bytes(self) -> [u8; { _ }]

source

pub fn inner(self) -> N

source

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

source§

impl<N> B64<N>where Self: AsRef<[u8]>,

source

pub fn b64(&self) -> String

source

pub fn b64_mini(&self) -> String

source§

impl B64<Vec<u8>>

source

pub fn parse_str(v: impl AsRef<[u8]>) -> Result<Self, B64Error>

source§

impl<const N: usize> B64<[u8; N]>

source

pub fn try_fit_bytes_or_b64(slice: &[u8]) -> Result<Self, B64Error>

source

pub fn try_fit_slice(slice: &[u8]) -> Result<Self, FitSliceErr>

source

pub fn parse_str(st: impl AsRef<[u8]>) -> Result<Self, DecodeError>

source§

impl B64<[u8; 32]>

source

pub fn to_u256(self) -> U256

source

pub fn from_u256(value: U256) -> Self

Trait Implementations§

source§

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

source§

impl<N: AsRef<[u8]>> AsRef<[u8]> for B64<N>

source§

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

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

impl AsRef<[u8; 32]> for B64<[u128; 2]>

source§

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

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

impl<N> AsRef<N> for B64<N>

source§

fn as_ref(&self) -> &N

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

impl BitXor<B64<[u8; 32]>> for B64<[u8; 32]>

§

type Output = B64<[u8; 32]>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: Self) -> Self::Output

Performs the ^ operation. Read more
source§

impl<N> Borrow<N> for B64<N>

source§

fn borrow(&self) -> &N

Immutably borrows from an owned value. Read more
source§

impl<N: Clone> Clone for B64<N>

source§

fn clone(&self) -> B64<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
source§

impl<N> Debug for B64<N>where Self: AsRef<[u8]>,

source§

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

Formats the value using the given formatter. Read more
source§

impl<N: Default> Default for B64<N>

source§

fn default() -> B64<N>

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

impl<N> Deref for B64<N>

§

type Target = N

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<N> DerefMut for B64<N>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<N> Display for B64<N>where Self: AsRef<[u8]>,

source§

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

Formats the value using the given formatter. Read more
source§

impl From<B64<[u8; 32]>> for U256

source§

fn from(val: B64<[u8; 32]>) -> Self

Converts to this type from the input type.
source§

impl From<B64<[u8; 64]>> for U512

source§

fn from(val: B64<[u8; 64]>) -> Self

Converts to this type from the input type.
source§

impl<N> From<B64<N>> for ABListwhere B64<N>: AsRef<[u8]>,

source§

fn from(val: B64<N>) -> Self

Converts to this type from the input type.
source§

impl<N> From<N> for B64<N>

source§

fn from(v: N) -> Self

Converts to this type from the input type.
source§

impl From<Uint<256, 4>> for B64<[u8; 32]>

source§

fn from(val: U256) -> Self

Converts to this type from the input type.
source§

impl From<Uint<512, 8>> for B64<[u8; 64]>

source§

fn from(val: U512) -> Self

Converts to this type from the input type.
source§

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

§

type Err = DecodeError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

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

impl<N: Hash> Hash for B64<N>

source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<N: Ord> Ord for B64<N>

source§

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

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

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<N: PartialEq> PartialEq<B64<N>> for B64<N>

source§

fn eq(&self, other: &B64<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.
source§

impl<N: PartialOrd> PartialOrd<B64<N>> for B64<N>

source§

fn partial_cmp(&self, other: &B64<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
source§

impl<N> ToABE for B64<N>where Self: AsRef<[u8]>,

source§

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

source§

fn to_abe_str(&self) -> String

source§

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

source§

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

§

type Error = FitSliceErr

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

fn try_from(value: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

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

§

type Error = DecodeError

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

fn try_from(value: ABList) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<N: Copy> Copy for B64<N>

source§

impl<N: Eq> Eq for B64<N>

source§

impl<N> StructuralEq for B64<N>

source§

impl<N> StructuralPartialEq for B64<N>

Auto Trait Implementations§

§

impl<N> RefUnwindSafe for B64<N>where N: RefUnwindSafe,

§

impl<N> Send for B64<N>where N: Send,

§

impl<N> Sync for B64<N>where N: Sync,

§

impl<N> Unpin for B64<N>where N: Unpin,

§

impl<N> UnwindSafe for B64<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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

const: unstable · source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.

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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.