pub fn perform_one_operation(&mut self, operation: &Operation) -> Result<Option<ADValue>> {
        self.replay_index = self.directions_bit_length;
        let res = self.return_result_of_one_operation(operation, &self.top_node());
        if res.is_err() {
            // take the bit length before fail and divide by 8 with rounding up
            let old_directions_byte_length = (self.replay_index + 7) / 8;
            // undo the changes to the directions array
            self.directions.truncate(old_directions_byte_length);
            self.directions_bit_length = self.replay_index;
            if (self.directions_bit_length & 7) > 0 {
                // 0 out the bits of the last element of the directions array
                // that are above directionsBitLength
                let mask = (1u8 << (self.directions_bit_length & 7)) - 1;
                *self.directions.last_mut().unwrap() &= mask;
            }
        }
        res
    }
///
/// If operation.key exists in the tree and the operation succeeds,
/// returns Success(Some(v)), where v is the value associated with operation.key
/// before the operation.
/// If operation.key does not exists in the tree and the operation succeeds, returns Success(None).
/// Returns Failure if the operation fails.
/// Does not modify the tree or the proof in case return is Failure.
///
/// @param operation
/// @return - Success(Some(old value)), Success(None), or Failure
////
If operation.key exists in the tree and the operation succeeds,
returns Success(Some(v)), where v is the value associated with operation.key
before the operation.
If operation.key does not exists in the tree and the operation succeeds, returns Success(None).
Returns Failure if the operation fails.
Does not modify the tree or the proof in case return is Failure.
If operation . key exists in the tree and the operation succeeds returns Success ( Some ( v )) where v is the value associated with operation . key before the operation . If operation . key does not exists in the tree and the operation succeeds returns Success ( None ) . Returns Failure if the operation fails . Does not modify the tree or the proof in case return is Failure .
pub fn perform_one_operation(&mut self, operation: &Operation) -> Result<Option<ADValue>> {
        self.replay_index = self.directions_bit_length;
        let res = self.return_result_of_one_operation(operation, &self.top_node());
        if res.is_err() {
            // take the bit length before fail and divide by 8 with rounding up
            let old_directions_byte_length = (self.replay_index + 7) / 8;
            // undo the changes to the directions array
            self.directions.truncate(old_directions_byte_length);
            self.directions_bit_length = self.replay_index;
            if (self.directions_bit_length & 7) > 0 {
                // 0 out the bits of the last element of the directions array
                // that are above directionsBitLength
                let mask = (1u8 << (self.directions_bit_length & 7)) - 1;
                *self.directions.last_mut().unwrap() &= mask;
            }
        }
        res
    }
pub fn perform_one_operation ( & mut self , operation : & Operation ) -> Result < Option < ADValue > > { self . replay_index = self . directions_bit_length ; let res = self . return_result_of_one_operation ( operation , & self . top_node ( ) ) ; if res . is_err ( ) { // take the bit length before fail and divide by 8 with rounding up let old_directions_byte_length = ( self . replay_index + 7 ) / 8 ; // undo the changes to the directions array self . directions . truncate ( old_directions_byte_length ) ; self . directions_bit_length = self . replay_index ; if ( self . directions_bit_length & 7 ) > 0 { // 0 out the bits of the last element of the directions array // that are above directionsBitLength let mask = ( 1u8 << ( self . directions_bit_length & 7 ) ) - 1 ; * self . directions . last_mut ( ) . unwrap ( ) &= mask ; } } res }
If operation.key exists in the tree and the operation succeeds,
returns Success(Some(v)), where v is the value associated with operation.key
before the operation.
If operation . key exists in the tree and the operation succeeds returns Success ( Some ( v )) where v is the value associated with operation . key before the operation .
&mut self
operation
&Operation
Success(Some(old value)), Success(None), or Failure
Success ( Some ( old value )) Success ( None ) or Failure
&mut self
operation
&Operation
None