pub enum ParserEvent<'a> {
Statement(&'a [u8]),
InsertRow {
header: &'a [u8],
row: &'a [u8],
first_in_statement: bool,
},
CopyStart(&'a [u8]),
CopyRow(&'a [u8]),
CopyEnd,
}Expand description
A single streaming event emitted by Parser::visit_events.
Data rows are treated as stream boundaries: a multi-row INSERT is delivered
as its shared header plus one ParserEvent::InsertRow per tuple, and a
COPY block as ParserEvent::CopyStart / one ParserEvent::CopyRow per
line / ParserEvent::CopyEnd — never buffering the whole block. All byte
slices borrow from the parser’s internal buffer (or, for InsertRow.header,
a small owned copy of the header) and are only valid until the callback
returns.
Variants§
Statement(&'a [u8])
A complete non-data statement (DDL / control), including its terminator.
InsertRow
One INSERT (...) value tuple. header is the statement text up to and
including the VALUES keyword (so the column list can be recovered);
first_in_statement is true for the first row of each INSERT so callers
can rebuild per-statement column context exactly once.
CopyStart(&'a [u8])
The COPY ... FROM stdin; header line that opens a COPY data block.
CopyRow(&'a [u8])
One raw COPY data line (newline stripped; a trailing \r, if any, is
left for the consumer to strip so it matches the collecting parser).
CopyEnd
The \. terminator that closes a COPY data block.
Auto Trait Implementations§
impl<'a> Freeze for ParserEvent<'a>
impl<'a> RefUnwindSafe for ParserEvent<'a>
impl<'a> Send for ParserEvent<'a>
impl<'a> Sync for ParserEvent<'a>
impl<'a> Unpin for ParserEvent<'a>
impl<'a> UnsafeUnpin for ParserEvent<'a>
impl<'a> UnwindSafe for ParserEvent<'a>
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more