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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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>,