Enum miden_objects::accounts::StorageSlotType
source · pub enum StorageSlotType {
Value {
value_arity: u8,
},
Map {
value_arity: u8,
},
Array {
depth: u8,
value_arity: u8,
},
}Expand description
An object that represents the type of a storage slot.
Variants§
Value
Represents a slot that contains a value with the specified arity.
Map
Represents a slot that contains a commitment to a map with values with the specified arity.
Array
Represents a slot that contains a commitment to an array with capacity 2^depth with values with the specified arity.
Implementations§
source§impl StorageSlotType
impl StorageSlotType
sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Returns true if this storage slot type is valid.
Valid storage slot types are defined as follows:
- value arity must be between 0 and 254 (inclusive).
- for Array types, depth must be between 2 and 64 (inclusive).
sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Returns true if this storage slot type is a value type with arity 0.
Trait Implementations§
source§impl Clone for StorageSlotType
impl Clone for StorageSlotType
source§fn clone(&self) -> StorageSlotType
fn clone(&self) -> StorageSlotType
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for StorageSlotType
impl Debug for StorageSlotType
source§impl Default for StorageSlotType
impl Default for StorageSlotType
source§impl From<&StorageSlotType> for Felt
impl From<&StorageSlotType> for Felt
source§fn from(value: &StorageSlotType) -> Self
fn from(value: &StorageSlotType) -> Self
source§impl From<&StorageSlotType> for u16
impl From<&StorageSlotType> for u16
source§fn from(value: &StorageSlotType) -> Self
fn from(value: &StorageSlotType) -> Self
source§impl From<StorageSlotType> for Felt
impl From<StorageSlotType> for Felt
source§fn from(slot_type: StorageSlotType) -> Self
fn from(slot_type: StorageSlotType) -> Self
Converts storage type into a field element as the following 32-bit values:
[value_arity, slot_data_type]
Where slot_data_type is 0 for Value type, 1 for Map type, and set to depth fro Array type.
source§impl From<StorageSlotType> for u16
impl From<StorageSlotType> for u16
source§fn from(slot_type: StorageSlotType) -> Self
fn from(slot_type: StorageSlotType) -> Self
Converts storage type into a u16 value as the following 2 bytes:
[value_arity, slot_data_type]
Where slot_data_type is 0 for Value type, 1 for Map type, and set to depth fro Array type.
source§impl PartialEq for StorageSlotType
impl PartialEq for StorageSlotType
source§fn eq(&self, other: &StorageSlotType) -> bool
fn eq(&self, other: &StorageSlotType) -> bool
self and other values to be equal, and is used
by ==.