fuel_core_storage

Trait 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.

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 BlobData

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