fuel_core_storage::blueprint

Trait BlueprintMutate

source
pub trait BlueprintMutate<M, S>: BlueprintInspect<M, S>
where M: Mappable, S: KeyValueMutate,
{ // Required methods fn put( storage: &mut S, key: &M::Key, column: S::Column, value: &M::Value, ) -> StorageResult<()>; fn replace( storage: &mut S, key: &M::Key, column: S::Column, value: &M::Value, ) -> StorageResult<Option<M::OwnedValue>>; fn take( storage: &mut S, key: &M::Key, column: S::Column, ) -> StorageResult<Option<M::OwnedValue>>; fn delete( storage: &mut S, key: &M::Key, column: S::Column, ) -> StorageResult<()>; }
Expand description

It is an extension of the BlueprintInspect that allows mutating the storage.

Required Methods§

source

fn put( storage: &mut S, key: &M::Key, column: S::Column, value: &M::Value, ) -> StorageResult<()>

Puts the key-value pair into the storage.

source

fn replace( storage: &mut S, key: &M::Key, column: S::Column, value: &M::Value, ) -> StorageResult<Option<M::OwnedValue>>

Puts the key-value pair into the storage and returns the old value.

source

fn take( storage: &mut S, key: &M::Key, column: S::Column, ) -> StorageResult<Option<M::OwnedValue>>

Takes the value from the storage and returns it. The value is removed from the storage.

source

fn delete(storage: &mut S, key: &M::Key, column: S::Column) -> StorageResult<()>

Removes the value from the storage.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<M, S, KeyCodec, ValueCodec> BlueprintMutate<M, S> for Plain<KeyCodec, ValueCodec>
where M: Mappable, S: KeyValueMutate, KeyCodec: Encode<M::Key> + Decode<M::OwnedKey>, ValueCodec: Encode<M::Value> + Decode<M::OwnedValue>,

source§

impl<M, S, KeyCodec, ValueCodec, Metadata, Nodes, Encoder> BlueprintMutate<M, S> for Merklized<KeyCodec, ValueCodec, Metadata, Nodes, Encoder>
where M: Mappable, S: KeyValueMutate + StorageMutate<Metadata, Error = Error> + StorageMutate<Nodes, Error = Error>, KeyCodec: Encode<M::Key> + Decode<M::OwnedKey>, ValueCodec: Encode<M::Value> + Decode<M::OwnedValue>, Encoder: Encode<M::Value>, Metadata: Mappable<Key = DenseMetadataKey<M::OwnedKey>, OwnedKey = DenseMetadataKey<M::OwnedKey>, Value = DenseMerkleMetadata, OwnedValue = DenseMerkleMetadata>, Nodes: Mappable<Key = u64, Value = Primitive, OwnedValue = Primitive>, for<'a> StructuredStorage<&'a mut S>: StorageMutate<Metadata, Error = Error> + StorageMutate<Nodes, Error = Error>,

source§

impl<M, S, KeyCodec, ValueCodec, Metadata, Nodes, KeyConverter> BlueprintMutate<M, S> for Sparse<KeyCodec, ValueCodec, Metadata, Nodes, KeyConverter>
where M: Mappable, S: KeyValueMutate + StorageMutate<Metadata, Error = Error> + StorageMutate<Nodes, Error = Error>, KeyCodec: Encode<M::Key> + Decode<M::OwnedKey>, ValueCodec: Encode<M::Value> + Decode<M::OwnedValue>, Metadata: Mappable<Value = SparseMerkleMetadata, OwnedValue = SparseMerkleMetadata>, Nodes: Mappable<Key = MerkleRoot, Value = Primitive, OwnedValue = Primitive>, KeyConverter: PrimaryKey<InputKey = M::Key, OutputKey = Metadata::Key>,