pub trait FromMidenRepr: Sized {
// Required methods
fn size_in_felts() -> usize;
fn from_bytes(bytes: &[u8]) -> Self;
// Provided methods
fn from_felts(felts: &[RawFelt]) -> Self { ... }
fn from_words(words: &[Word]) -> Self { ... }
fn pop_from_stack(stack: &mut Vec<RawFelt>) -> Self { ... }
}Required Methods§
Sourcefn size_in_felts() -> usize
fn size_in_felts() -> usize
Returns the size of this type as encoded by ToMidenRepr::to_felts
Sourcefn from_bytes(bytes: &[u8]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
Extract a value of this type from bytes, where:
- It is assumed that bytes is always padded out to 4 byte alignment
- It is assumed that the bytes are in little-endian order, as encoded by ToMidenRepr
Provided Methods§
Sourcefn from_felts(felts: &[RawFelt]) -> Self
fn from_felts(felts: &[RawFelt]) -> Self
Extract a value of this type as encoded in a vector of field elements, where:
- The order of the field elements is little-endian, i.e. the element holding the least significant bytes comes first.
Sourcefn from_words(words: &[Word]) -> Self
fn from_words(words: &[Word]) -> Self
Extract a value of this type as encoded in a vector of words, where:
- The order of the words is little-endian, i.e. the word holding the least significant bytes comes first.
- The order of the field elements in each word is in big-endian order, i.e. the element with the most significant byte is at the start of the word, and the element with the least significant byte is at the end of the word. This corresponds to the order in which elements are placed on the operand stack when preparing to read or write them from Miden’s memory.
Sourcefn pop_from_stack(stack: &mut Vec<RawFelt>) -> Self
fn pop_from_stack(stack: &mut Vec<RawFelt>) -> Self
Pop a value of this type from stack based on the canonical representation of this type
on the operand stack when writing it to memory (and as read from memory).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.