pub trait Decode: Sized { }Expand description
A type which can be decoded from bytes with decode.
Must use #[derive(Decode)] to implement.
#[derive(bitcode::Decode)]
// If your struct contains itself you must annotate it with `#[bitcode(recursive)]`.
// This disables certain speed optimizations that aren't possible on recursive types.
struct MyStruct {
a: u32,
b: bool,
// If you want to use serde::Deserialize on a field instead of bitcode::Decode.
#[cfg(feature = "serde")]
#[bitcode(with_serde)]
c: String,
}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.