pub trait BFieldCodec {
type Error: Into<Box<dyn Error + Send + Sync>> + 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§
fn decode(sequence: &[BFieldElement]) -> Result<Box<Self>, Self::Error>
fn encode(&self) -> Vec<BFieldElement>
Sourcefn static_length() -> Option<usize>
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.