/// Compute the Merkle root hash for the given slice of `leaves`.
///
/// The values in `leaves` can be a pre-hashed slice of [`struct@Hash<D>`] or
/// any type that implements [`AsRef<[u8]>`][`AsRef`].
///
/// For types implementing [`AsRef<[u8]>`][`AsRef`], the values will be hashed
/// according to the [`Digest`][`DigestExt`] implementation, `D`.
Compute the Merkle root hash for the given slice of `leaves`.


Compute the Merkle root hash for the given slice of ` leaves ` .
pub fn compute_merkle_root<D, L>(leaves: &[L]) -> Hash<D>
where
  D: DigestExt,
  L: AsLeaf<D>,
{
  #[inline]
  fn __generate<D, L>(digest: &mut D, leaves: &[L]) -> Hash<D>
  where
    D: DigestExt,
    L: AsLeaf<D>,
  {
    match leaves {
      [] => digest.hash_empty(),
      [leaf] => leaf.hash(digest),
      leaves => {
        let (this, that): _ = __split_pow2(leaves);
        let lhs: Hash<D> = __generate(digest, this);
        let rhs: Hash<D> = __generate(digest, that);
        digest.hash_node(&lhs, &rhs)
      }
    }
  }
  __generate::<D, L>(&mut D::new(), leaves)
}
pub fn compute_merkle_root < D , L > ( leaves : & [ L ] ) -> Hash < D > where D : DigestExt , L : AsLeaf < D > , { # [ inline ] fn __generate < D , L > ( digest : & mut D , leaves : & [ L ] ) -> Hash < D > where D : DigestExt , L : AsLeaf < D > , { match leaves { [ ] => digest . hash_empty ( ) , [ leaf ] => leaf . hash ( digest ) , leaves => { let ( this , that ) : _ = __split_pow2 ( leaves ) ; let lhs : Hash < D > = __generate ( digest , this ) ; let rhs : Hash < D > = __generate ( digest , that ) ; digest . hash_node ( & lhs , & rhs ) } } } __generate :: < D , L > ( & mut D :: new ( ) , leaves ) }
Compute the Merkle root hash for the given slice of `leaves`.
Compute the Merkle root hash for the given slice of ` leaves ` .
leaves
&[L]