Skip to main content

RecordParser

Trait RecordParser 

Source
pub(super) trait RecordParser: Send {
    // Required methods
    fn feed(&mut self, data: &[u8]) -> PgWireResult<Vec<Row>>;
    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 must keep state across [feed] calls because records (and even single fields) may span chunk boundaries. [finish] is called at CopyDone; a final record without a trailing record separator is accepted.

Required Methods§

Source

fn feed(&mut self, data: &[u8]) -> PgWireResult<Vec<Row>>

Feeds a chunk of CopyData bytes and returns all complete rows.

Source

fn finish(&mut self) -> PgWireResult<Vec<Row>>

Parses the buffered tail at CopyDone; returns no row when the stream ended exactly at a record boundary.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§