pub trait Element: Default {
// Required methods
fn len(ctx: &Config) -> usize;
fn validate(&self, preamble: &Preamble) -> Result<()>;
// Provided method
fn validate_buffer(config: &Config, buffer: &[u8]) -> Result<()> { ... }
}Expand description
Describe a CDF element
Required Methods§
Sourcefn len(ctx: &Config) -> usize
fn len(ctx: &Config) -> usize
Serializable length
Every element is a function of the config so seek/lookups will be constant-time.
The serialized type must not contain more bytes than specified here. However, it might, optionally, use less bytes. Regardless, it will consume this defined amount of bytes during serialization.
Provided Methods§
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.