Trait ToMidenRepr

Source
pub trait ToMidenRepr {
    // Required method
    fn to_bytes(&self) -> SmallVec<[u8; 16]>;

    // Provided methods
    fn to_felts(&self) -> SmallVec<[RawFelt; 4]> { ... }
    fn to_words(&self) -> SmallVec<[Word; 1]> { ... }
    fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>) { ... }
    fn push_words_to_advice_stack(&self, stack: &mut Vec<RawFelt>) -> usize { ... }
}

Required Methods§

Source

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Convert this type into its raw byte representation

The order of bytes in the resulting vector should be little-endian, i.e. the least significant bytes come first.

Provided Methods§

Source

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Convert this type into one or more field elements, where the order of the elements is such that the byte representation of self is in little-endian order, i.e. the least significant bytes come first.

Source

fn to_words(&self) -> SmallVec<[Word; 1]>

Convert this type into one or more words, zero-padding as needed, such that:

  • The field elements within each word is in little-endian order, i.e. the least significant bytes of come first.
  • Each word, if pushed on the operand stack element-by-element, would leave the element with the most significant bytes on top of the stack (including padding)
Source

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Push this value on the given operand stack using Self::to_felts representation

Source

fn push_words_to_advice_stack(&self, stack: &mut Vec<RawFelt>) -> usize

Push this value in its Self::to_words representation, on the given stack.

This function is designed for encoding values that will be placed on the advice stack and copied into Miden VM memory by the compiler-emitted test harness.

Returns the number of words that were pushed on the stack

Implementations on Foreign Types§

Source§

impl ToMidenRepr for bool

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Source§

impl ToMidenRepr for i8

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Source§

impl ToMidenRepr for i16

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Source§

impl ToMidenRepr for i32

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Source§

impl ToMidenRepr for i64

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

impl ToMidenRepr for i128

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

impl ToMidenRepr for u8

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Source§

impl ToMidenRepr for u16

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Source§

impl ToMidenRepr for u32

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn push_to_operand_stack(&self, stack: &mut Vec<RawFelt>)

Source§

impl ToMidenRepr for u64

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

impl ToMidenRepr for u128

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

impl ToMidenRepr for Felt

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Source§

fn to_felts(&self) -> SmallVec<[RawFelt; 4]>

Source§

fn to_words(&self) -> SmallVec<[Word; 1]>

Source§

impl<const N: usize> ToMidenRepr for [u8; N]

Source§

fn to_bytes(&self) -> SmallVec<[u8; 16]>

Implementors§

Source§

impl ToMidenRepr for midenc_debug::Felt