pub trait Mappable {
    type Key;
    type SetValue: ?Sized;
    type GetValue: Clone;
}
Expand description

Mappable type with Key and Value.

Required Associated Types

The type of the value’s key.

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

Example
use core::marker::PhantomData;
use fuel_storage::Mappable;
pub struct Contract<'a>(PhantomData<&'a ()>);

impl<'a> Mappable for Contract<'a> {
    type Key = &'a [u8; 32];
    /// It is optimized to use slice instead of vector.
    type SetValue = [u8];
    type GetValue = Vec<u8>;
}

The value type is used while getting the value from the storage.

Implementors