Struct fuel_vm::storage::ContractsState
source · pub struct ContractsState<'a>(_);
Expand description
The storage table for contract’s hashed key-value state.
Lifetime is for optimization to avoid clone
.
Trait Implementations§
source§impl<'a> Mappable for ContractsState<'a>
impl<'a> Mappable for ContractsState<'a>
§type Key = (&'a ContractId, &'a Bytes32)
type Key = (&'a ContractId, &'a Bytes32)
The table key is combination of the ContractId
and Bytes32
hash of the value’s key.
§type GetValue = <ContractsState<'a> as Mappable>::SetValue
type GetValue = <ContractsState<'a> as Mappable>::SetValue
The value type is used while getting the value from the storage.
source§impl MerkleRootStorage<ContractId, ContractsState<'_>> for MemoryStorage
impl MerkleRootStorage<ContractId, ContractsState<'_>> for MemoryStorage
source§fn root(&mut self, parent: &ContractId) -> Result<MerkleRoot, Infallible>
fn root(&mut self, parent: &ContractId) -> Result<MerkleRoot, Infallible>
Return the merkle root of the stored
Type
in the storage. Read moresource§impl StorageInspect<ContractsState<'_>> for MemoryStorage
impl StorageInspect<ContractsState<'_>> for MemoryStorage
type Error = Infallible
source§fn get(
&self,
key: &(&ContractId, &Bytes32)
) -> Result<Option<Cow<'_, Bytes32>>, Infallible>
fn get(
&self,
key: &(&ContractId, &Bytes32)
) -> Result<Option<Cow<'_, Bytes32>>, Infallible>
Retrieve
Cow<Value>
such as Key->Value
.source§fn contains_key(&self, key: &(&ContractId, &Bytes32)) -> Result<bool, Infallible>
fn contains_key(&self, key: &(&ContractId, &Bytes32)) -> Result<bool, Infallible>
Return
true
if there is a Key
mapping to a value in the storage.source§impl StorageMutate<ContractsState<'_>> for MemoryStorage
impl StorageMutate<ContractsState<'_>> for MemoryStorage
source§fn insert(
&mut self,
key: &(&ContractId, &Bytes32),
value: &Bytes32
) -> Result<Option<Bytes32>, Infallible>
fn insert(
&mut self,
key: &(&ContractId, &Bytes32),
value: &Bytes32
) -> Result<Option<Bytes32>, Infallible>
Append
Key->Value
mapping to the storage. Read moresource§fn remove(
&mut self,
key: &(&ContractId, &Bytes32)
) -> Result<Option<Bytes32>, Infallible>
fn remove(
&mut self,
key: &(&ContractId, &Bytes32)
) -> Result<Option<Bytes32>, Infallible>
Remove
Key->Value
mapping from the storage. Read more