pub trait FromFeltRepr: Sized {
const FIXED_LEN: Option<usize> = None;
// Required method
fn from_felt_repr(
reader: &mut FeltReader<'_>,
) -> Result<Self, FeltReprError>;
}Expand description
Trait for deserialization from felt memory representation.
Provided Associated Constants§
Sourceconst FIXED_LEN: Option<usize> = None
const FIXED_LEN: Option<usize> = None
Total encoded length in felts, when statically known.
None marks a variable-length encoding: a type containing Vec or Option fields, or an
enum whose variants encode to different lengths. When Some(n), n must equal the exact
number of felts consumed by Self::from_felt_repr (and produced by the matching
ToFeltRepr implementation, if any).
Defaults to None, which is always correct for a manual implementation — consumers that
dispatch on the length (e.g. the tx-script args transport) merely fall back to their
variable-length path. Override it with the exact count to enable fixed-length dispatch;
#[derive(FromFeltRepr)] computes it automatically.
Required Methods§
Sourcefn from_felt_repr(reader: &mut FeltReader<'_>) -> Result<Self, FeltReprError>
fn from_felt_repr(reader: &mut FeltReader<'_>) -> Result<Self, FeltReprError>
Deserializes from a FeltReader, consuming the required elements.
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 FromFeltRepr for bool
impl FromFeltRepr for bool
const FIXED_LEN: Option<usize>
fn from_felt_repr(reader: &mut FeltReader<'_>) -> Result<bool, FeltReprError>
Source§impl FromFeltRepr for u8
impl FromFeltRepr for u8
const FIXED_LEN: Option<usize>
fn from_felt_repr(reader: &mut FeltReader<'_>) -> Result<u8, FeltReprError>
Source§impl FromFeltRepr for u32
impl FromFeltRepr for u32
const FIXED_LEN: Option<usize>
fn from_felt_repr(reader: &mut FeltReader<'_>) -> Result<u32, FeltReprError>
Source§impl FromFeltRepr for u64
impl FromFeltRepr for u64
const FIXED_LEN: Option<usize>
fn from_felt_repr(reader: &mut FeltReader<'_>) -> Result<u64, FeltReprError>
Source§impl<T> FromFeltRepr for Option<T>where
T: FromFeltRepr,
Encodes an Option<T> as a 1-felt tag followed by the payload (if present).
impl<T> FromFeltRepr for Option<T>where
T: FromFeltRepr,
Encodes an Option<T> as a 1-felt tag followed by the payload (if present).
Format:
None=>[0]Some(x)=>[1, x...]
fn from_felt_repr( reader: &mut FeltReader<'_>, ) -> Result<Option<T>, FeltReprError>
Source§impl<T> FromFeltRepr for Vec<T>where
T: FromFeltRepr,
Encodes a Vec<T> as a length prefix followed by elements.
impl<T> FromFeltRepr for Vec<T>where
T: FromFeltRepr,
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.