[][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]

Makes new Z128 variant with all bytes set to 0

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

Makes new Z224 variant with all bytes set to 0

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

Makes new Z256 variant with all bytes set to 0

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

Makes new Z384 variant with all bytes set to 0

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

Makes new Z512 variant with all bytes set to 0

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])));

Trait Implementations

impl Eq for Zeros[src]

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

impl PartialEq<Zeros> for Zeros[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Clone for Zeros[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl AsRef<[u8]> 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 Vec<u8>[src]

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

impl<'_> From<&'_ Zeros> for String[src]

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

Examples

use zeros::Zeros;

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

impl From<Zeros> for String[src]

Converts a Zeros into a hexadecimal string, in lower-case

impl Debug for Zeros[src]

impl Display for Zeros[src]

impl Hash for Zeros[src]

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

Feeds a slice of this type into the given [Hasher]. Read more

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.

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

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl Send for Zeros

impl Sync for Zeros

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

impl<T> From<T> for T[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.

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

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

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