pub struct ParsedAction { /* private fields */ }Expand description
A bulk action line parsed once: its verb plus the _index/_id/routing
metadata. The streaming demux parses each action line a single time into this,
uses ParsedAction::has_source to decide whether a source line follows
before framing the next line, then ParsedAction::into_item to finalize the
op — so the action line’s JSON is never parsed twice (ADR-014 stage 4). The
buffered parse_bulk already parses each line once.
Implementations§
Source§impl ParsedAction
impl ParsedAction
Sourcepub fn action(&self) -> BulkAction
pub fn action(&self) -> BulkAction
The parsed verb.
Sourcepub fn has_source(&self) -> bool
pub fn has_source(&self) -> bool
Whether a source line follows this action (index/create/update do, delete does not), so the streaming reader knows to frame one before finalizing.
Sourcepub fn into_item(
self,
source_line: Option<&[u8]>,
) -> Result<BulkItem, RewriteError>
pub fn into_item( self, source_line: Option<&[u8]>, ) -> Result<BulkItem, RewriteError>
Finalizes the op from the already-parsed action plus, for source-bearing
verbs, its source line. The source is kept as raw bytes, validated but not
materialized, exactly as parse_bulk does.
§Errors
RewriteError::MalformedBulkAction if a source-bearing action has no
source line, RewriteError::InvalidJson if the source line is not valid
JSON.