pub enum StorageKey {
Account(Account),
Int(i64),
Principal(Principal),
Subaccount(Subaccount),
Timestamp(Timestamp),
Uint(u64),
Ulid(Ulid),
Unit,
}Expand description
StorageKey
Storage-normalized scalar key used by persistence and indexing.
This type defines the only on-disk representation for scalar keys.
It is deliberately separated from typed identity (Ref<E>).
Variants§
Account(Account)
Int(i64)
Principal(Principal)
Subaccount(Subaccount)
Timestamp(Timestamp)
Uint(u64)
Ulid(Ulid)
Unit
Implementations§
Source§impl StorageKey
impl StorageKey
Sourcepub const STORED_SIZE_BYTES: u64 = 64
pub const STORED_SIZE_BYTES: u64 = 64
Fixed serialized size in bytes (protocol invariant). DO NOT CHANGE without migration.
pub const STORED_SIZE_USIZE: usize
pub const fn try_from_value( value: &Value, ) -> Result<Self, StorageKeyEncodeError>
Sourcepub fn max_storable() -> Self
pub fn max_storable() -> Self
Sentinel key representing the maximum storable value.
pub const fn lower_bound() -> Self
pub const fn upper_bound() -> Self
Sourcepub fn to_bytes(&self) -> Result<[u8; 64], StorageKeyEncodeError>
pub fn to_bytes(&self) -> Result<[u8; 64], StorageKeyEncodeError>
Encode this key into its fixed-size on-disk representation.
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self, &'static str>
Trait Implementations§
Source§impl CandidType for StorageKey
impl CandidType for StorageKey
Source§impl Clone for StorageKey
impl Clone for StorageKey
Source§fn clone(&self) -> StorageKey
fn clone(&self) -> StorageKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StorageKey
impl Debug for StorageKey
Source§impl<'de> Deserialize<'de> for StorageKey
impl<'de> Deserialize<'de> for StorageKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for StorageKey
impl Display for StorageKey
Source§impl Hash for StorageKey
impl Hash for StorageKey
Source§impl Ord for StorageKey
impl Ord for StorageKey
Source§impl PartialEq for StorageKey
impl PartialEq for StorageKey
Source§impl PartialOrd for StorageKey
impl PartialOrd for StorageKey
Source§impl Serialize for StorageKey
impl Serialize for StorageKey
Source§impl TryFrom<&[u8]> for StorageKey
impl TryFrom<&[u8]> for StorageKey
impl Copy for StorageKey
impl Eq for StorageKey
impl StructuralPartialEq for StorageKey
Auto Trait Implementations§
impl Freeze for StorageKey
impl RefUnwindSafe for StorageKey
impl Send for StorageKey
impl Sync for StorageKey
impl Unpin for StorageKey
impl UnsafeUnpin for StorageKey
impl UnwindSafe for StorageKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more