Skip to main content

ParsedAction

Struct ParsedAction 

Source
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

Source

pub fn action(&self) -> BulkAction

The parsed verb.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for ParsedAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.