pub unsafe trait SerializeBuf<E: Encoding = Vanilla>: SerializeIter<E> {
const SIZE: usize;
}Expand description
This trait defines a more rigid/static serialization interface.
Types that implement this trait can be serialized to and from buffers with an exact length. This length being the maximum needed for any value of the implementer type.
To implement this trait, the type must already implement
SerializeIter and the implementer must compute
the necessary length of the serialization medium.
§Safety
The length of the associated Serialized type is critical.
An insufficient length will result in UB. Best to leave
this implementation to the procedural macro.
Required Associated Constants§
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.