pub fn write<W: Write>(&self, mut writer: W) -> std::io::Result<()> {
        writer.write_all(&u128_to_u8_vector(self.last_filled_position))?;
        match self.left {
            None => writer.write_all(&[0])?,
            Some(node) => {
                writer.write_all(&[1])?;
                node.write(writer.by_ref())?;
            }
        }
        match self.right {
            None => writer.write_all(&[0])?,
            Some(node) => {
                writer.write_all(&[1])?;
                node.write(writer.by_ref())?;
            }
        }
        writer.write_all(&u64_array_to_u8_vector(&[self.parents.len() as u64]))?;
        for parent in &self.parents {
            match parent {
                None => writer.write_all(&[0])?,
                Some(node) => {
                    writer.write_all(&[1])?;
                    node.write(writer.by_ref())?;
                }
            }
        }
        Ok(())
    }
/// Write a MerkleTree to a writer.
Write a MerkleTree to a writer.
Write a MerkleTree to a writer .
pub fn write<W: Write>(&self, mut writer: W) -> std::io::Result<()> {
        writer.write_all(&u128_to_u8_vector(self.last_filled_position))?;
        match self.left {
            None => writer.write_all(&[0])?,
            Some(node) => {
                writer.write_all(&[1])?;
                node.write(writer.by_ref())?;
            }
        }
        match self.right {
            None => writer.write_all(&[0])?,
            Some(node) => {
                writer.write_all(&[1])?;
                node.write(writer.by_ref())?;
            }
        }
        writer.write_all(&u64_array_to_u8_vector(&[self.parents.len() as u64]))?;
        for parent in &self.parents {
            match parent {
                None => writer.write_all(&[0])?,
                Some(node) => {
                    writer.write_all(&[1])?;
                    node.write(writer.by_ref())?;
                }
            }
        }
        Ok(())
    }
pub fn write < W : Write > ( & self , mut writer : W ) -> std :: io :: Result < ( ) > { writer . write_all ( & u128_to_u8_vector ( self . last_filled_position ) ) ? ; match self . left { None => writer . write_all ( & [ 0 ] ) ? , Some ( node ) => { writer . write_all ( & [ 1 ] ) ? ; node . write ( writer . by_ref ( ) ) ? ; } } match self . right { None => writer . write_all ( & [ 0 ] ) ? , Some ( node ) => { writer . write_all ( & [ 1 ] ) ? ; node . write ( writer . by_ref ( ) ) ? ; } } writer . write_all ( & u64_array_to_u8_vector ( & [ self . parents . len ( ) as u64 ] ) ) ? ; for parent in & self . parents { match parent { None => writer . write_all ( & [ 0 ] ) ? , Some ( node ) => { writer . write_all ( & [ 1 ] ) ? ; node . write ( writer . by_ref ( ) ) ? ; } } } Ok ( ( ) ) }
Write a MerkleTree to a writer.
Write a MerkleTree to a writer .
&self
writer
W
&self
writer
W