Skip to main content

WordValue

Trait WordValue 

Source
pub trait WordValue: Sized {
    // Required methods
    fn try_into_word(self) -> Result<Word, &'static str>;
    fn try_from_word(word: Word) -> Result<Self, &'static str>;
}
Expand description

A type that can be stored in (or loaded from) account storage.

Storage slots and map items store a single Word. Implementations must define a reversible conversion between the Rust type and a Word.

Required Methods§

Source

fn try_into_word(self) -> Result<Word, &'static str>

Converts the value into the single storage word used by the host.

Source

fn try_from_word(word: Word) -> Result<Self, &'static str>

Reconstructs the value from the single storage word returned by the host.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl WordValue for AccountId

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for AssetAmount

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for Digest

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for Felt

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for NoteIdx

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for NoteType

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for Recipient

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for Tag

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Source§

impl WordValue for Word

Source§

fn try_into_word(self) -> Result<Word, &'static str>

Source§

fn try_from_word(word: Word) -> Result<Self, &'static str>

Implementors§