pub fn to_bytes(&self) -> Vec<u8> {
        let mut result = Vec::with_capacity(
            4 + 4 + self.indices.len() * 4 + self.values.len() * D::output_size(),
        );
        let len = u32::try_from(self.values.len()).expect("Length must fit in u32");
        let size_batch = u32::try_from(self.indices.len()).expect("Length must fit in u32");
        result.extend_from_slice(&len.to_be_bytes());
        result.extend_from_slice(&size_batch.to_be_bytes());

        for &index in &self.indices {
            result.extend_from_slice(
                &u32::try_from(index)
                    .expect("Length must fit in u32")
                    .to_be_bytes(),
            );
        }

        for node in &self.values {
            result.extend_from_slice(node.as_slice());
        }
        result
    }
/// Convert the `BatchPath` into byte representation.
///
/// # Layout
/// The layout of a `Path` is
/// * Length of proof, $n$
/// * Size of batch
/// * Indices of elements
/// * $n$ hash outputs
Convert the `BatchPath` into byte representation.
Convert the ` BatchPath ` into byte representation .
pub fn to_bytes(&self) -> Vec<u8> {
        let mut result = Vec::with_capacity(
            4 + 4 + self.indices.len() * 4 + self.values.len() * D::output_size(),
        );
        let len = u32::try_from(self.values.len()).expect("Length must fit in u32");
        let size_batch = u32::try_from(self.indices.len()).expect("Length must fit in u32");
        result.extend_from_slice(&len.to_be_bytes());
        result.extend_from_slice(&size_batch.to_be_bytes());
        for &index in &self.indices {
            result.extend_from_slice(
                &u32::try_from(index)
                    .expect("Length must fit in u32")
                    .to_be_bytes(),
            );
        }
        for node in &self.values {
            result.extend_from_slice(node.as_slice());
        }
        result
    }
pub fn to_bytes ( & self ) -> Vec < u8 > { let mut result = Vec :: with_capacity ( 4 + 4 + self . indices . len ( ) * 4 + self . values . len ( ) * D :: output_size ( ) , ) ; let len = u32 :: try_from ( self . values . len ( ) ) . expect ( " " ) ; let size_batch = u32 :: try_from ( self . indices . len ( ) ) . expect ( " " ) ; result . extend_from_slice ( & len . to_be_bytes ( ) ) ; result . extend_from_slice ( & size_batch . to_be_bytes ( ) ) ; for & index in & self . indices { result . extend_from_slice ( & u32 :: try_from ( index ) . expect ( " " ) . to_be_bytes ( ) , ) ; } for node in & self . values { result . extend_from_slice ( node . as_slice ( ) ) ; } result }
Convert the `BatchPath` into byte representation.
Convert the ` BatchPath ` into byte representation .
&self
layout
The layout of a `Path` is
Length of proof, $n$
Size of batch
Indices of elements
$n$ hash outputs
The layout of a ` Path ` is Length of proof $n$ Size of batch Indices of elements $n$ hash outputs