pub trait StorageMutate<Type>: StorageInspect<Type>where
    Type: Mappable,{
    // Required methods
    fn insert(
        &mut self,
        key: &<Type as Mappable>::Key,
        value: &<Type as Mappable>::Value
    ) -> Result<Option<<Type as Mappable>::OwnedValue>, Self::Error>;
    fn remove(
        &mut self,
        key: &<Type as Mappable>::Key
    ) -> Result<Option<<Type as Mappable>::OwnedValue>, Self::Error>;
}
Expand description

Base storage trait for Fuel infrastructure.

Generic should implement Mappable trait with all storage type information.

Required Methods§

fn insert( &mut self, key: &<Type as Mappable>::Key, value: &<Type as Mappable>::Value ) -> Result<Option<<Type as Mappable>::OwnedValue>, Self::Error>

Append Key->Value mapping to the storage.

If Key was already mappped to a value, return the replaced value as Ok(Some(Value)). Return Ok(None) otherwise.

fn remove( &mut self, key: &<Type as Mappable>::Key ) -> Result<Option<<Type as Mappable>::OwnedValue>, Self::Error>

Remove Key->Value mapping from the storage.

Return Ok(Some(Value)) if the value was present. If the key wasn’t found, return Ok(None).

Implementations on Foreign Types§

source§

impl StorageMutate<ContractsState> for MemoryStorage

source§

fn insert( &mut self, key: &<ContractsState as Mappable>::Key, value: &Bytes32 ) -> Result<Option<Bytes32>, Infallible>

source§

fn remove( &mut self, key: &<ContractsState as Mappable>::Key ) -> Result<Option<Bytes32>, Infallible>

source§

impl<Type> StorageMutate<Type> for PredicateStoragewhere Type: Mappable,

source§

fn insert( &mut self, _key: &<Type as Mappable>::Key, _value: &<Type as Mappable>::Value ) -> Result<Option<<Type as Mappable>::OwnedValue>, InterpreterError>

source§

fn remove( &mut self, _key: &<Type as Mappable>::Key ) -> Result<Option<<Type as Mappable>::OwnedValue>, InterpreterError>

source§

impl StorageMutate<ContractsAssets> for MemoryStorage

source§

fn insert( &mut self, key: &<ContractsAssets as Mappable>::Key, value: &u64 ) -> Result<Option<u64>, Infallible>

source§

fn remove( &mut self, key: &<ContractsAssets as Mappable>::Key ) -> Result<Option<u64>, Infallible>

source§

impl StorageMutate<ContractsRawCode> for MemoryStorage

source§

fn insert( &mut self, key: &ContractId, value: &[u8] ) -> Result<Option<Contract>, Infallible>

source§

fn remove(&mut self, key: &ContractId) -> Result<Option<Contract>, Infallible>

source§

impl StorageMutate<ContractsInfo> for MemoryStorage

source§

fn insert( &mut self, key: &ContractId, value: &(Salt, Bytes32) ) -> Result<Option<(Salt, Bytes32)>, Infallible>

source§

fn remove( &mut self, key: &ContractId ) -> Result<Option<(Salt, Bytes32)>, Infallible>

§

impl<Type> StorageMutate<Type> for StorageMap<Type>where Type: Mappable, <Type as Mappable>::Key: Eq + Hash, <Type as Mappable>::OwnedKey: Eq + Hash + Borrow<<Type as Mappable>::Key>,

§

fn insert( &mut self, key: &<Type as Mappable>::Key, value: &<Type as Mappable>::Value ) -> Result<Option<<Type as Mappable>::OwnedValue>, <StorageMap<Type> as StorageInspect<Type>>::Error>

§

fn remove( &mut self, key: &<Type as Mappable>::Key ) -> Result<Option<<Type as Mappable>::OwnedValue>, <StorageMap<Type> as StorageInspect<Type>>::Error>

§

impl<'a, T, Type> StorageMutate<Type> for &'a mut Twhere T: StorageMutate<Type> + ?Sized, Type: Mappable,

§

fn insert( &mut self, key: &<Type as Mappable>::Key, value: &<Type as Mappable>::Value ) -> Result<Option<<Type as Mappable>::OwnedValue>, <&'a mut T as StorageInspect<Type>>::Error>

§

fn remove( &mut self, key: &<Type as Mappable>::Key ) -> Result<Option<<Type as Mappable>::OwnedValue>, <&'a mut T as StorageInspect<Type>>::Error>

Implementors§