triton_vm::prelude

Trait BFieldCodec

Source
pub trait BFieldCodec {
    type Error: Into<Box<dyn Error + Sync + Send>> + Debug + Display;

    // Required methods
    fn decode(sequence: &[BFieldElement]) -> Result<Box<Self>, Self::Error>;
    fn encode(&self) -> Vec<BFieldElement>;
    fn static_length() -> Option<usize>;
}
Expand description

This trait provides functions for encoding to and decoding from a Vec of BFieldElements. This encoding does not record the size of objects nor their type information; this is the responsibility of the decoder.

Required Associated Types§

Required Methods§

Source

fn decode(sequence: &[BFieldElement]) -> Result<Box<Self>, Self::Error>

Source

fn encode(&self) -> Vec<BFieldElement>

Source

fn static_length() -> Option<usize>

Returns the length in number of BFieldElements if it is known at compile-time. Otherwise, None.

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.

Implementations on Foreign Types§

Source§

impl BFieldCodec for bool

Source§

impl BFieldCodec for u8

Source§

impl BFieldCodec for u16

Source§

impl BFieldCodec for u32

Source§

impl BFieldCodec for u64

Source§

impl BFieldCodec for u128

Source§

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

Source§

impl<T> BFieldCodec for Box<T>
where T: BFieldCodec,

Source§

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

Source§

impl<T> BFieldCodec for PhantomData<T>

Source§

impl<T, S> BFieldCodec for (T, S)
where T: BFieldCodec, S: BFieldCodec,

Source§

impl<T, const N: usize> BFieldCodec for [T; N]
where T: BFieldCodec,

Implementors§

Source§

impl BFieldCodec for ProofItem

Source§

impl BFieldCodec for ProofItemVariant

Source§

impl BFieldCodec for Claim

Source§

impl BFieldCodec for Proof

Source§

impl BFieldCodec for FriResponse

Source§

impl BFieldCodec for ProofStream

Source§

impl BFieldCodec for PublicInput

Source§

impl BFieldCodec for MmrAccumulator

Source§

impl BFieldCodec for MmrMembershipProof

Source§

impl BFieldCodec for MmrSuccessorProof

Source§

impl BFieldCodec for BFieldElement

Source§

impl BFieldCodec for Digest

Source§

impl BFieldCodec for Program

Source§

impl BFieldCodec for Tip5

Source§

impl BFieldCodec for XFieldElement

Source§

impl<T> BFieldCodec for Polynomial<'_, T>
where T: BFieldCodec + FiniteField + 'static,

Source§

impl<const N: usize> BFieldCodec for U32s<N>