fn subtree_with_prefix(&mut self, prefix: &SliceData, gas_consumer: &mut dyn GasConsumer) -> Result<()> {
        let prefix_len = prefix.remaining_bits();
        if prefix_len == 0 || self.bit_len() < prefix_len {
            return Ok(())
        }
        if let Some(root) = self.data() {
            let mut cursor = LabelReader::new(gas_consumer.load_cell(root.clone())?);
            let (key, rem_prefix) = down_by_tree::<Self>(prefix, &mut cursor, self.bit_len(), gas_consumer)?;
            if rem_prefix.is_none() {
                let label = SliceData::from(key.into_cell()?);
                let mut remainder = cursor.remainder()?;
                let is_leaf = Self::is_leaf(&mut remainder);
                if remainder.cell() != root {
                    let root = Self::make_cell_with_label_and_data(label, self.bit_len(), is_leaf, &remainder)?;
                    *self.data_mut() = Some(gas_consumer.finalize_cell(root)?)
                }
            } else {
                *self.data_mut() = None
            }
        }
        Ok(())
    }
/// transform to subtree with the common prefix
transform to subtree with the common prefix
transform to subtree with the common prefix
fn subtree_with_prefix(&mut self, prefix: &SliceData, gas_consumer: &mut dyn GasConsumer) -> Result<()> {
        let prefix_len = prefix.remaining_bits();
        if prefix_len == 0 || self.bit_len() < prefix_len {
            return Ok(())
        }
        if let Some(root) = self.data() {
            let mut cursor = LabelReader::new(gas_consumer.load_cell(root.clone())?);
            let (key, rem_prefix) = down_by_tree::<Self>(prefix, &mut cursor, self.bit_len(), gas_consumer)?;
            if rem_prefix.is_none() {
                let label = SliceData::from(key.into_cell()?);
                let mut remainder = cursor.remainder()?;
                let is_leaf = Self::is_leaf(&mut remainder);
                if remainder.cell() != root {
                    let root = Self::make_cell_with_label_and_data(label, self.bit_len(), is_leaf, &remainder)?;
                    *self.data_mut() = Some(gas_consumer.finalize_cell(root)?)
                }
            } else {
                *self.data_mut() = None
            }
        }
        Ok(())
    }
fn subtree_with_prefix ( & mut self , prefix : & SliceData , gas_consumer : & mut dyn GasConsumer ) -> Result < ( ) > { let prefix_len = prefix . remaining_bits ( ) ; if prefix_len == 0 || self . bit_len ( ) < prefix_len { return Ok ( ( ) ) } if let Some ( root ) = self . data ( ) { let mut cursor = LabelReader :: new ( gas_consumer . load_cell ( root . clone ( ) ) ? ) ; let ( key , rem_prefix ) = down_by_tree :: < Self > ( prefix , & mut cursor , self . bit_len ( ) , gas_consumer ) ? ; if rem_prefix . is_none ( ) { let label = SliceData :: from ( key . into_cell ( ) ? ) ; let mut remainder = cursor . remainder ( ) ? ; let is_leaf = Self :: is_leaf ( & mut remainder ) ; if remainder . cell ( ) != root { let root = Self :: make_cell_with_label_and_data ( label , self . bit_len ( ) , is_leaf , & remainder ) ? ; * self . data_mut ( ) = Some ( gas_consumer . finalize_cell ( root ) ? ) } } else { * self . data_mut ( ) = None } } Ok ( ( ) ) }
transform to subtree with the common prefix
transform to subtree with the common prefix
&mut self
prefix
&SliceData
gas_consumer
&mut dyn GasConsumer
&mut self
prefix
&SliceData
gas_consumer
&mut dyn GasConsumer