[][src]Struct zeros::ReadOnlyZeros

pub struct ReadOnlyZeros { /* fields omitted */ }

Read-only zeros

This struct is simply a read-only wrapper of Zeros.

Examples

use std::convert::TryFrom;
use zeros::{ReadOnlyZeros, Zeros};

const SOME_HASH: ReadOnlyZeros = ReadOnlyZeros::new(Zeros::Z128([
    0xb2, 0xc2, 0x5d, 0x4b, 0x26, 0xd9, 0xfc, 0xb0,
    0xb3, 0x6f, 0xc9, 0xdf, 0x33, 0xb2, 0x8b, 0x46,
]));

// Zeros implements AsRef<[u8]> and TryFrom<&[u8]>
let another_hash = Zeros::try_from(SOME_HASH.as_ref())?;
assert_eq!(SOME_HASH, another_hash);
assert_eq!(SOME_HASH.to_string(), another_hash.to_string());
assert_eq!(SOME_HASH, ReadOnlyZeros::from(another_hash));

Methods

impl ReadOnlyZeros[src]

pub const fn new(zeros: Zeros) -> Self[src]

Methods from Deref<Target = Zeros>

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 Clone for ReadOnlyZeros[src]

impl Debug for ReadOnlyZeros[src]

impl Deref for ReadOnlyZeros[src]

type Target = Zeros

The resulting type after dereferencing.

impl Display for ReadOnlyZeros[src]

impl Eq for ReadOnlyZeros[src]

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

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

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

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

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

impl From<Zeros> for ReadOnlyZeros[src]

impl Hash for ReadOnlyZeros[src]

impl PartialEq<ReadOnlyZeros> for ReadOnlyZeros[src]

impl PartialEq<ReadOnlyZeros> for Zeros[src]

impl PartialEq<Zeros> for ReadOnlyZeros[src]

impl StructuralEq for ReadOnlyZeros[src]

impl StructuralPartialEq for ReadOnlyZeros[src]

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

type Error = Error

The type returned in the event of a conversion error.

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

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

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.