pub(crate) fn metered_add_gs_unsafe(
        &mut self,
        key: Key,
        value: StoredValue,
    ) -> Result<(), Error> {
        let value_bytes_count = value.serialized_length();
        self.charge_gas_storage(value_bytes_count)?;

        match self
            .tracking_copy
            .borrow_mut()
            .add(self.correlation_id, key, value)
        {
            Err(storage_error) => Err(storage_error.into()),
            Ok(AddResult::Success) => Ok(()),
            Ok(AddResult::KeyNotFound(key)) => Err(Error::KeyNotFound(key)),
            Ok(AddResult::TypeMismatch(type_mismatch)) => Err(Error::TypeMismatch(type_mismatch)),
            Ok(AddResult::Serialization(error)) => Err(Error::BytesRepr(error)),
        }
    }
/// Adds data to a global state key and charges for bytes stored.
///
/// This method performs full validation of the key to be written.
Adds data to a global state key and charges for bytes stored.
This method performs full validation of the key to be written.
Adds data to a global state key and charges for bytes stored . This method performs full validation of the key to be written .
pub(crate) fn metered_add_gs_unsafe(
        &mut self,
        key: Key,
        value: StoredValue,
    ) -> Result<(), Error> {
        let value_bytes_count = value.serialized_length();
        self.charge_gas_storage(value_bytes_count)?;
        match self
            .tracking_copy
            .borrow_mut()
            .add(self.correlation_id, key, value)
        {
            Err(storage_error) => Err(storage_error.into()),
            Ok(AddResult::Success) => Ok(()),
            Ok(AddResult::KeyNotFound(key)) => Err(Error::KeyNotFound(key)),
            Ok(AddResult::TypeMismatch(type_mismatch)) => Err(Error::TypeMismatch(type_mismatch)),
            Ok(AddResult::Serialization(error)) => Err(Error::BytesRepr(error)),
        }
    }
pub ( crate ) fn metered_add_gs_unsafe ( & mut self , key : Key , value : StoredValue , ) -> Result < ( ) , Error > { let value_bytes_count = value . serialized_length ( ) ; self . charge_gas_storage ( value_bytes_count ) ? ; match self . tracking_copy . borrow_mut ( ) . add ( self . correlation_id , key , value ) { Err ( storage_error ) => Err ( storage_error . into ( ) ) , Ok ( AddResult :: Success ) => Ok ( ( ) ) , Ok ( AddResult :: KeyNotFound ( key ) ) => Err ( Error :: KeyNotFound ( key ) ) , Ok ( AddResult :: TypeMismatch ( type_mismatch ) ) => Err ( Error :: TypeMismatch ( type_mismatch ) ) , Ok ( AddResult :: Serialization ( error ) ) => Err ( Error :: BytesRepr ( error ) ) , } }
Adds data to a global state key and charges for bytes stored.
Adds data to a global state key and charges for bytes stored .
&mut self
key
Key
value
StoredValue
&mut self
key
Key
value
StoredValue