pub trait CustomSerializer: Send + Sync {
// Required methods
fn serialize(&self, data: &[u8]) -> Result<Vec<u8>>;
fn deserialize(&self, data: &[u8]) -> Result<Vec<u8>>;
fn format_name(&self) -> &str;
// Provided methods
fn format_version(&self) -> &str { ... }
fn magic_bytes(&self) -> Option<&[u8]> { ... }
fn supports_zero_copy(&self) -> bool { ... }
fn validate_schema(&self, _schema: &[u8], _data: &[u8]) -> Result<bool> { ... }
fn stats(&self) -> SerializerStats { ... }
}Expand description
Custom serializer trait
Required Methods§
Sourcefn format_name(&self) -> &str
fn format_name(&self) -> &str
Get format name
Provided Methods§
Sourcefn format_version(&self) -> &str
fn format_version(&self) -> &str
Get format version
Sourcefn magic_bytes(&self) -> Option<&[u8]>
fn magic_bytes(&self) -> Option<&[u8]>
Get magic bytes for format detection
Sourcefn supports_zero_copy(&self) -> bool
fn supports_zero_copy(&self) -> bool
Supports zero-copy deserialization
Sourcefn validate_schema(&self, _schema: &[u8], _data: &[u8]) -> Result<bool>
fn validate_schema(&self, _schema: &[u8], _data: &[u8]) -> Result<bool>
Validate schema (optional)
Sourcefn stats(&self) -> SerializerStats
fn stats(&self) -> SerializerStats
Get serialization statistics