pub(super) trait RecordParser: Send {
// Required methods
fn plan_input(&self, data: &[u8], budget: usize) -> (usize, usize);
fn decode(&mut self, data: &[u8]) -> PgWireResult<(usize, usize)>;
fn is_full(&self) -> bool;
fn flush(&mut self) -> PgWireResult<Vec<Row>>;
// Provided method
fn finish(&mut self) -> PgWireResult<Vec<Row>> { ... }
}Expand description
Incremental parser of one COPY FROM STDIN stream.
The wire protocol delivers the payload as an arbitrary sequence of
CopyData chunks; implementations keep state across Self::decode
calls because records (and even single fields) may span chunk boundaries.
The caller reserves memory before decoding and drains each full batch before
supplying more input, even when one CopyData message contains many batches.
Required Methods§
Sourcefn plan_input(&self, data: &[u8], budget: usize) -> (usize, usize)
fn plan_input(&self, data: &[u8], budget: usize) -> (usize, usize)
Returns the input prefix to decode and the bytes to charge for it.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".