pub fn build_layer_2<'a>(nodes: Vec<Node>, crypto: &Provider) -> Result<Vec<Node>, Error> {
    let mut layer = Vec::<Node>::with_capacity(nodes.len() / 2 + (nodes.len() % 2 != 0) as usize);
    let mut nodes_iter = nodes.into_iter();
    while let Some(left) = nodes_iter.next() {
        if let Some(right) = nodes_iter.next() {
            layer.push(hash_branch(left, right, &crypto).unwrap());
        } else {
            layer.push(left);
        }
    }
    Ok(layer)
}
/// Builds one layer of branch nodes from a layer of child nodes.
Builds one layer of branch nodes from a layer of child nodes.
Builds one layer of branch nodes from a layer of child nodes .
pub fn build_layer_2<'a>(nodes: Vec<Node>, crypto: &Provider) -> Result<Vec<Node>, Error> {
    let mut layer = Vec::<Node>::with_capacity(nodes.len() / 2 + (nodes.len() % 2 != 0) as usize);
    let mut nodes_iter = nodes.into_iter();
    while let Some(left) = nodes_iter.next() {
        if let Some(right) = nodes_iter.next() {
            layer.push(hash_branch(left, right, &crypto).unwrap());
        } else {
            layer.push(left);
        }
    }
    Ok(layer)
}
pub fn build_layer_2 < ' a > ( nodes : Vec < Node > , crypto : & Provider ) -> Result < Vec < Node > , Error > { let mut layer = Vec :: < Node > :: with_capacity ( nodes . len ( ) / 2 + ( nodes . len ( ) % 2 != 0 ) as usize ) ; let mut nodes_iter = nodes . into_iter ( ) ; while let Some ( left ) = nodes_iter . next ( ) { if let Some ( right ) = nodes_iter . next ( ) { layer . push ( hash_branch ( left , right , & crypto ) . unwrap ( ) ) ; } else { layer . push ( left ) ; } } Ok ( layer ) }
Builds one layer of branch nodes from a layer of child nodes.
Builds one layer of branch nodes from a layer of child nodes .
nodes
Vec<Node>
crypto
&Provider
nodes
Vec<Node>
crypto
&Provider