pub trait BinarySerializer<T: Clone = ()> {
// Required methods
fn serialize(
&self,
config: Option<&mut SerializerConfig<T>>,
) -> Result<Vec<u8>, SerializationError>;
fn write_bytes(
&self,
buffer: &mut Vec<u8>,
config: Option<&mut SerializerConfig<T>>,
) -> Result<(), SerializationError>;
// Provided method
fn to_bytes(&self) -> Result<Vec<u8>, SerializationError> { ... }
}