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

        for node in &self.values {
            result.extend_from_slice(node.as_slice());
        }
        result
    }
/// Convert the `Path` into byte representation. The size of a path is
/// $8 + 8 + n * S$ where $n$ is the number of hashes in the path and
/// $S$ the output size of the digest function.
///
/// # Layout
/// The layout of a `Path` is
/// * Length of path
/// * Index of element
/// * $n$ hash outputs
Convert the `Path` into byte representation.
Convert the ` Path ` into byte representation .
pub fn to_bytes(&self) -> Vec<u8> {
        let mut result = Vec::with_capacity(4 + 4 + self.values.len() * D::output_size());
        let len = u32::try_from(self.values.len()).expect("Length must fit in u32");
        result.extend_from_slice(&len.to_be_bytes());
        result.extend_from_slice(
            &u32::try_from(self.index)
                .expect("Index 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 . values . len ( ) * D :: output_size ( ) ) ; let len = u32 :: try_from ( self . values . len ( ) ) . expect ( " " ) ; result . extend_from_slice ( & len . to_be_bytes ( ) ) ; result . extend_from_slice ( & u32 :: try_from ( self . index ) . expect ( " " ) . to_be_bytes ( ) , ) ; for node in & self . values { result . extend_from_slice ( node . as_slice ( ) ) ; } result }
Convert the `Path` into byte representation.
Convert the ` Path ` into byte representation .
&self
layout
The layout of a `Path` is
Length of path
Index of element
$n$ hash outputs
The layout of a ` Path ` is Length of path Index of element $n$ hash outputs