ParallelDigest

Trait ParallelDigest 

Source
pub trait ParallelDigest: Send {
    type Digest: Digest + Send;

    // Required methods
    fn new() -> Self;
    fn new_with_prefix(data: impl AsRef<[u8]>) -> Self;
    fn digest<I: IntoIterator<Item: SerializeBytes>>(
        &self,
        source: impl IndexedParallelIterator<Item = I>,
        out: &mut [MaybeUninit<Output<Self::Digest>>],
    );
}

Required Associated Types§

Source

type Digest: Digest + Send

The corresponding non-parallelized hash function.

Required Methods§

Source

fn new() -> Self

Create new hasher instance with empty state.

Source

fn new_with_prefix(data: impl AsRef<[u8]>) -> Self

Create new hasher instance which has processed the provided data.

Source

fn digest<I: IntoIterator<Item: SerializeBytes>>( &self, source: impl IndexedParallelIterator<Item = I>, out: &mut [MaybeUninit<Output<Self::Digest>>], )

Calculate the digest of multiple hashes by processing a parallel iterator of iterators.

The source parameter provides a parallel iterator where:

  • Each element of the outer iterator maps to one leaf/digest in the output
  • Each element contains an inner iterator of items that will be serialized and concatenated to form that leaf’s content
§Panics

All items must be able to serialize with SerializationMode::Native without error, or this method will panic.

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.

Implementors§

Source§

impl<D: MultiDigest<N, Digest: Send> + Send + Sync, const N: usize> ParallelDigest for ParallelMultidigestImpl<D, N>

Source§

impl<D: Digest + BlockSizeUser + Send + Sync + Clone> ParallelDigest for D