Trait fuel_core_storage::Mappable

source ·
pub trait Mappable {
    type Key: ToOwned + ?Sized;
    type OwnedKey: From<<Self::Key as ToOwned>::Owned> + Clone;
    type Value: ToOwned + ?Sized;
    type OwnedValue: From<<Self::Value as ToOwned>::Owned> + Clone;
}
Expand description

Mappable type with Key and Value.

§Example

use fuel_storage::Mappable;
pub struct Contract;

impl Mappable for Contract {
    /// The `[u8; 32]` is a primitive type, so we can't optimize it more.
    type Key = Self::OwnedKey;
    type OwnedKey = [u8; 32];
    /// It is optimized to use slice instead of vector.
    type Value = [u8];
    type OwnedValue = Vec<u8>;
}

Required Associated Types§

source

type Key: ToOwned + ?Sized

The key type is used during interaction with the storage. In most cases, it is the same as Self::OwnedKey.

source

type OwnedKey: From<<Self::Key as ToOwned>::Owned> + Clone

The owned type of the Key retrieving from the storage.

source

type Value: ToOwned + ?Sized

The value type is used while setting the value to the storage. In most cases, it is the same as Self::OwnedValue, but it is without restriction and can be used for performance optimizations.

source

type OwnedValue: From<<Self::Value as ToOwned>::Owned> + Clone

The owned type of the Value retrieving from the storage.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Mappable for NodesTable

source§

impl Mappable for NodesTable

Implementors§

source§

impl Mappable for ContractsAssetsMerkleData

source§

impl Mappable for ContractsAssetsMerkleMetadata

source§

impl Mappable for ContractsStateMerkleData

source§

impl Mappable for ContractsStateMerkleMetadata

source§

impl Mappable for FuelBlockMerkleData

source§

impl Mappable for FuelBlockMerkleMetadata

source§

impl Mappable for Coins

source§

impl Mappable for ConsensusParametersVersions

source§

impl Mappable for ContractsAssets

source§

impl Mappable for ContractsLatestUtxo

source§

impl Mappable for ContractsRawCode

source§

impl Mappable for ContractsState

source§

impl Mappable for FuelBlocks

source§

impl Mappable for Messages

source§

impl Mappable for ProcessedTransactions

source§

impl Mappable for SealedBlockConsensus

source§

impl Mappable for StateTransitionBytecodeVersions

source§

impl Mappable for Transactions

source§

impl Mappable for UploadedBytecodes