nimue::hash

Trait Unit

Source
pub trait Unit:
    Clone
    + Sized
    + Zeroize {
    // Required methods
    fn write(bunch: &[Self], w: &mut impl Write) -> Result<(), Error>;
    fn read(r: &mut impl Read, bunch: &mut [Self]) -> Result<(), Error>;
}
Expand description

Basic units over which a sponge operates.

We require the units to have a precise size in memory, to be cloneable, and that we can zeroize them.

Required Methods§

Source

fn write(bunch: &[Self], w: &mut impl Write) -> Result<(), Error>

Write a bunch of units in the wire.

Source

fn read(r: &mut impl Read, bunch: &mut [Self]) -> Result<(), Error>

Read a bunch of units from the wire

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Unit for u8

Source§

fn write(bunch: &[Self], w: &mut impl Write) -> Result<(), Error>

Source§

fn read(r: &mut impl Read, bunch: &mut [Self]) -> Result<(), Error>

Source§

impl<C: FpConfig<N>, const N: usize> Unit for Fp<C, N>

Source§

fn write(bunch: &[Self], w: &mut impl Write) -> Result<(), Error>

Source§

fn read(r: &mut impl Read, bunch: &mut [Self]) -> Result<(), Error>

Implementors§