[][src]Enum zeros::Zeros

pub enum Zeros {
    Z128(Z128),
    Z224(Z224),
    Z256(Z256),
    Z384(Z384),
    Z512(Z512),
}

Zeros

Features

  • Can be converted from some common hash slices such as [u8; 16], [u8; 64]...

  • Implemented Display, which prints hex string of the hash, in lower-case.

  • Implemented Eq and Hash traits, so you can use it in HashSet, HashMap...

  • Debug implementation:

    • {:#?} prints bytes in hexadecimal format.
    • {:?} prints bytes in decimal format.

Hexadecimal format (in lower case)

Examples:

use zeros::Zeros;

let zeros = Zeros::from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]);
assert_eq!(zeros.to_string(), "000102030405060708090a0b0c0d0e0f");

Variants

Z128(Z128)
Z224(Z224)
Z256(Z256)
Z384(Z384)
Z512(Z512)

Methods

impl Zeros[src]

pub const fn new_128() -> Self[src]

pub const fn new_224() -> Self[src]

pub const fn new_256() -> Self[src]

pub const fn new_384() -> Self[src]

pub const fn new_512() -> Self[src]

pub fn len(&self) -> usize[src]

pub fn same_class(&self, other: &Self) -> bool[src]

Checks if this instance is same class as one other

Examples

use zeros::Zeros;

assert!(Zeros::from([0; 16]).same_class(&Zeros::from([0; 32])) == false);
assert!(Zeros::from([6; 48]).same_class(&Zeros::from([9; 48])));

pub fn to_vec(&self) -> Vec<u8>[src]

Trait Implementations

impl AsMut<[u8]> for Zeros[src]

impl AsRef<[u8]> for Zeros[src]

impl Clone for Zeros[src]

impl Debug for Zeros[src]

impl Display for Zeros[src]

Formats a &Zeros into a hexadecimal string, in lower-case

Examples

use zeros::Zeros;

assert_eq!(
    Zeros::from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]).to_string(),
    "000102030405060708090a0b0c0d0e0f",
);

impl Eq for Zeros[src]

impl From<[u8; 16]> for Zeros[src]

impl From<[u8; 28]> for Zeros[src]

impl From<[u8; 32]> for Zeros[src]

impl From<[u8; 48]> for Zeros[src]

impl From<[u8; 64]> for Zeros[src]

impl From<Zeros> for ReadOnlyZeros[src]

impl Hash for Zeros[src]

impl PartialEq<[u8]> for Zeros[src]

impl PartialEq<ReadOnlyZeros> for Zeros[src]

impl PartialEq<Zeros> for ReadOnlyZeros[src]

impl PartialEq<Zeros> for Zeros[src]

impl PartialEq<Zeros> for [u8][src]

impl<'_> TryFrom<&'_ [u8]> for Zeros[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Vec<u8>> for Zeros[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Zeros> for Z128[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Zeros> for Z224[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Zeros> for Z256[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Zeros> for Z384[src]

type Error = Error

The type returned in the event of a conversion error.

impl TryFrom<Zeros> for Z512[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Zeros

impl Send for Zeros

impl Sync for Zeros

impl Unpin for Zeros

impl UnwindSafe for Zeros

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.