Skip to main content

ToFeltRepr

Trait ToFeltRepr 

Source
pub trait ToFeltRepr {
    // Required method
    fn write_felt_repr(&self, writer: &mut FeltWriter<'_>);

    // Provided method
    fn to_felt_repr(&self) -> Vec<Felt> { ... }
}
Expand description

Trait for serializing a type into its felt memory representation.

Required Methods§

Source

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Writes this value’s felt representation to the writer.

Provided Methods§

Source

fn to_felt_repr(&self) -> Vec<Felt>

Convenience method that allocates and returns a Vec<Felt>.

Implementations on Foreign Types§

Source§

impl ToFeltRepr for bool

Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Source§

impl ToFeltRepr for u8

Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Source§

impl ToFeltRepr for u32

Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Source§

impl ToFeltRepr for u64

Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Source§

impl ToFeltRepr for Felt

Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Source§

impl ToFeltRepr for BaseElement

Available on non-target_family=wasm only.
Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Source§

impl<T> ToFeltRepr for Option<T>
where T: ToFeltRepr,

Encodes an Option<T> as a 1-felt tag followed by the payload (if present).

Format:

  • None => [0]
  • Some(x) => [1, x...]
Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Source§

impl<T> ToFeltRepr for Vec<T>
where T: ToFeltRepr,

Encodes a Vec<T> as a length prefix followed by elements.

Format: [len, elem0..., elemN-1...] where len is a u32 encoded in a single Felt.

Source§

fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)

Implementors§