[][src]Struct zeros::ReadOnlyZeros

pub struct ReadOnlyZeros(pub Zeros);

Read-only zeros

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

  • If you need a constant, you can make this struct directly from its constructor.
  • Or you can use Zeros::read_only().

Examples

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

const SOME_HASH: ReadOnlyZeros = ReadOnlyZeros(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, another_hash.read_only());

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

Trait Implementations

impl Eq for ReadOnlyZeros[src]

impl PartialEq<ReadOnlyZeros> for ReadOnlyZeros[src]

impl PartialEq<Zeros> for ReadOnlyZeros[src]

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

This method tests for !=.

impl PartialEq<ReadOnlyZeros> for Zeros[src]

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

This method tests for !=.

impl Clone for ReadOnlyZeros[src]

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

Performs copy-assignment from source. Read more

impl Deref for ReadOnlyZeros[src]

type Target = Zeros

The resulting type after dereferencing.

impl Debug for ReadOnlyZeros[src]

impl Display for ReadOnlyZeros[src]

impl Hash for ReadOnlyZeros[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

Auto Trait Implementations

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]