pub trait PacketSink {
// Required methods
fn write(&mut self, record: &PacketRecord) -> Result<(), ExportError>;
fn close(&mut self) -> Result<u64, ExportError>;
}Expand description
Common interface for streaming packet writers.
Each format (JSON, Parquet, Avro) provides its own implementation.
Records are pushed one at a time via write; [close] flushes any
internal buffer and returns the total packet count.
Required Methods§
Sourcefn write(&mut self, record: &PacketRecord) -> Result<(), ExportError>
fn write(&mut self, record: &PacketRecord) -> Result<(), ExportError>
Write a single packet record to the output.
Sourcefn close(&mut self) -> Result<u64, ExportError>
fn close(&mut self) -> Result<u64, ExportError>
Flush all buffered data and finalise the output file.
Returns the total number of records written.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".