pub fn from_bytes(bytes: &[u8]) -> Result<Self, MerkleTreeError> {
        let mut usize_bytes = [0u8; 4];
        usize_bytes.copy_from_slice(&bytes[..4]);
        let nr_leaves = usize::try_from(u32::from_be_bytes(usize_bytes))
            .expect("Library should be built in 32 bit targets or higher");
        if bytes[4..].len() == D::output_size() {
            return Ok(Self {
                value: bytes[4..].to_vec(),
                nr_leaves,
                hasher: PhantomData::default(),
            });
        }
        Err(MerkleTreeError::InvalidSizedBytes)
    }
/// Convert a byte array into a `MerkleTreeCommitment`.
Convert a byte array into a `MerkleTreeCommitment`.
Convert a byte array into a ` MerkleTreeCommitment ` .
pub fn from_bytes(bytes: &[u8]) -> Result<Self, MerkleTreeError> {
        let mut usize_bytes = [0u8; 4];
        usize_bytes.copy_from_slice(&bytes[..4]);
        let nr_leaves = usize::try_from(u32::from_be_bytes(usize_bytes))
            .expect("Library should be built in 32 bit targets or higher");
        if bytes[4..].len() == D::output_size() {
            return Ok(Self {
                value: bytes[4..].to_vec(),
                nr_leaves,
                hasher: PhantomData::default(),
            });
        }
        Err(MerkleTreeError::InvalidSizedBytes)
    }
pub fn from_bytes ( bytes : & [ u8 ] ) -> Result < Self , MerkleTreeError > { let mut usize_bytes = [ 0u8 ; 4 ] ; usize_bytes . copy_from_slice ( & bytes [ .. 4 ] ) ; let nr_leaves = usize :: try_from ( u32 :: from_be_bytes ( usize_bytes ) ) . expect ( " " ) ; if bytes [ 4 .. ] . len ( ) == D :: output_size ( ) { return Ok ( Self { value : bytes [ 4 .. ] . to_vec ( ) , nr_leaves , hasher : PhantomData :: default ( ) , } ) ; } Err ( MerkleTreeError :: InvalidSizedBytes ) }
Convert a byte array into a `MerkleTreeCommitment`.
Convert a byte array into a ` MerkleTreeCommitment ` .
bytes
&[u8]