Struct B64

#[repr(transparent)]
pub struct B64<N>(pub N);
Expand description

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

Tuple Fields§

§0: N

Implementations§

§

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

pub fn into_bytes(self) -> [u8; N]

pub fn from_ref(b: &[u8; N]) -> &B64<[u8; N]>

pub fn slice_into_bytes(slice: &[B64<[u8; N]>]) -> &[u8]

pub fn slice_from_bytes( slice: &[u8], ) -> Result<&[B64<[u8; N]>], (&[B64<[u8; N]>], &[u8])>

pub fn try_from_exact(slice: &[u8]) -> Result<B64<[u8; N]>, MatchErrorKind>

pub fn new(b: [u8; N]) -> B64<[u8; N]>

§

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

pub fn b64(&self) -> String

pub fn b64_mini(&self) -> String

§

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

pub fn try_fit_bytes_or_b64(slice: &[u8]) -> Result<B64<[u8; N]>, DecodeError>

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

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

§

impl B64<[u8; 32]>

pub fn to_u256(self) -> Uint<256, 4>

pub fn from_u256(value: Uint<256, 4>) -> B64<[u8; 32]>

pub fn leading_zeros(self) -> usize

Trait Implementations§

§

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

§

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

§

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

§

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

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

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

§

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

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

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

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

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

§

fn as_ref(&self) -> &B64<N>

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

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

§

fn as_ref(&self) -> &N

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

impl BitXor for B64<[u8; 32]>

§

type Output = B64<[u8; 32]>

The resulting type after applying the ^ operator.
§

fn bitxor(self, rhs: B64<[u8; 32]>) -> <B64<[u8; 32]> as BitXor>::Output

Performs the ^ operation. Read more
§

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

§

fn borrow(&self) -> &N

Immutably borrows from an owned value. Read more
§

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

§

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
§

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

§

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

Formats the value using the given formatter. Read more
§

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

§

fn default() -> B64<N>

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

impl<N> Deref for B64<N>

§

type Target = N

The resulting type after dereferencing.
§

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

Dereferences the value.
§

impl<N> DerefMut for B64<N>

§

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

Mutably dereferences the value.
§

impl<'de, const N: usize> Deserialize<'de> for B64<[u8; N]>

§

fn deserialize<D>( deserializer: D, ) -> Result<B64<[u8; N]>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

impl<'de> Deserialize<'de> for B64<Vec<u8>>

§

fn deserialize<D>( deserializer: D, ) -> Result<B64<Vec<u8>>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

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

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

§

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

Formats the value using the given formatter. Read more
§

impl From<&dyn Point> for B64<[u8; 32]>

§

fn from(val: &dyn Point) -> B64<[u8; 32]>

Converts to this type from the input type.
§

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

§

fn from(v: B64<[u8; 32]>) -> XHeader

Converts to this type from the input type.
§

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

§

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

Converts to this type from the input type.
§

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

§

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

Converts to this type from the input type.
§

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

§

fn from(val: Uint<256, 4>) -> B64<[u8; 32]>

Converts to this type from the input type.
§

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

§

fn from(val: Uint<512, 8>) -> B64<[u8; 64]>

Converts to this type from the input type.
§

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

§

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

Converts to this type from the input type.
§

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

§

type Err = DecodeError

The associated error which can be returned from parsing.
§

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

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

impl FromStr for B64<Vec<u8>>

§

type Err = DecodeError

The associated error which can be returned from parsing.
§

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

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

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

§

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

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
§

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

§

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) -> Self
where Self: Sized,

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

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

§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

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

§

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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

impl<B> Serialize for B64<B>
where B: AsRef<[u8]>,

§

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

§

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

§

fn write_abe_str(&self, out: &mut dyn Write) -> Result<(), Error>

§

fn to_abe_str(&self) -> String

§

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

§

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

§

type Error = FitSliceErr

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

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

Performs the conversion.
§

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

§

type Error = DecodeError

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

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

Performs the conversion.
§

impl UInt for B64<[u8; 32]>

§

const MIN: B64<[u8; 32]>

§

const MAX: B64<[u8; 32]>

§

const ONE: B64<[u8; 32]>

§

const BITS: u32 = 256u32

§

const BYTE_SIZE: usize = 32usize

§

fn bit_and(self, other: B64<[u8; 32]>) -> B64<[u8; 32]>

§

fn bit_or(self, other: B64<[u8; 32]>) -> B64<[u8; 32]>

§

fn not(self) -> B64<[u8; 32]>

§

fn inc(self) -> Option<B64<[u8; 32]>>

§

fn decr(self) -> Option<B64<[u8; 32]>>

§

fn checked_sub(self, other: B64<[u8; 32]>) -> Option<B64<[u8; 32]>>

§

fn checked_add(self, other: B64<[u8; 32]>) -> Option<B64<[u8; 32]>>

§

fn overflowing_shl(self, rhs: u32) -> (B64<[u8; 32]>, bool)

§

fn overflowing_shr(self, rhs: u32) -> (B64<[u8; 32]>, bool)

§

fn leading_zeros(&self) -> u32

§

fn trailing_zeros(&self) -> u32

§

fn trailing_ones(&self) -> u32

§

fn leading_ones(&self) -> u32

§

fn overflowing_add(self, rhs: B64<[u8; 32]>) -> (B64<[u8; 32]>, bool)

§

fn as_be_bytes(&self, out: &mut dyn FnMut(&[u8]))

§

fn to_be_vec(&self) -> Vec<u8>

§

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

§

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

§

impl<N> StructuralPartialEq for B64<N>

Auto Trait Implementations§

§

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

§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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.

§

impl<T> Instrument for T

§

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

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

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 T
where 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.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

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

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

Source§

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 T
where U: TryFrom<T>,

Source§

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 T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

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