pub trait SessionFormat: Send + Sync {
// Required methods
fn format(&self) -> Format;
fn serialize(&self, log: &TxLog) -> FormatResult<Vec<u8>>;
fn deserialize(&self, data: &[u8]) -> FormatResult<TxLog>;
fn serialize_to_file(&self, log: &TxLog, file: File) -> FormatResult<()>;
fn deserialize_from_reader(
&self,
reader: BufReader<File>,
) -> FormatResult<TxLog>;
}Expand description
Trait for session serialization formats.
Implement this trait to add support for new serialization formats.
Required Methods§
Sourcefn deserialize(&self, data: &[u8]) -> FormatResult<TxLog>
fn deserialize(&self, data: &[u8]) -> FormatResult<TxLog>
Deserialize a TxLog from bytes.
Sourcefn serialize_to_file(&self, log: &TxLog, file: File) -> FormatResult<()>
fn serialize_to_file(&self, log: &TxLog, file: File) -> FormatResult<()>
Serialize directly to a file (more efficient for large logs).
Sourcefn deserialize_from_reader(
&self,
reader: BufReader<File>,
) -> FormatResult<TxLog>
fn deserialize_from_reader( &self, reader: BufReader<File>, ) -> FormatResult<TxLog>
Deserialize directly from a buffered reader.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".