pub trait RecordSerializer: Send + Sync {
// Required methods
fn serialize(&self, batch: &RecordBatch) -> Result<Vec<Vec<u8>>, SerdeError>;
fn format(&self) -> Format;
// Provided method
fn serialize_batch(
&self,
batch: &RecordBatch,
) -> Result<Vec<u8>, SerdeError> { ... }
}Expand description
Trait for serializing Arrow RecordBatch into raw bytes.
Implementations convert from Arrow columnar format to external formats for writing to sinks.
Required Methods§
Provided Methods§
Sourcefn serialize_batch(&self, batch: &RecordBatch) -> Result<Vec<u8>, SerdeError>
fn serialize_batch(&self, batch: &RecordBatch) -> Result<Vec<u8>, SerdeError>
Serializes a RecordBatch into a single byte buffer.
For formats that support batch encoding (e.g., JSON array, CSV), this may be more efficient than serializing individual records.
§Errors
Returns SerdeError if serialization fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".