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§
Sourcefn write_felt_repr(&self, writer: &mut FeltWriter<'_>)
fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)
Writes this value’s felt representation to the writer.
Provided Methods§
Sourcefn to_felt_repr(&self) -> Vec<Felt>
fn to_felt_repr(&self) -> Vec<Felt>
Convenience method that allocates and returns a Vec<Felt>.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ToFeltRepr for Felt
impl ToFeltRepr for Felt
fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)
Source§impl ToFeltRepr for bool
impl ToFeltRepr for bool
fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)
Source§impl ToFeltRepr for u8
impl ToFeltRepr for u8
fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)
Source§impl ToFeltRepr for u32
impl ToFeltRepr for u32
fn write_felt_repr(&self, writer: &mut FeltWriter<'_>)
Source§impl ToFeltRepr for u64
impl ToFeltRepr for u64
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).
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...]
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.
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.