Trait unnest_ndjson::Sinker
source · [−]pub trait Sinker: MiniWrite {
fn observe_new_item(
&mut self,
path: &[Vec<u8>],
header_style: HeaderStyle
) -> Result<()> { ... }
fn observe_end(&mut self, header_style: HeaderStyle) -> Result<()> { ... }
}
Expand description
Consume the individual JSON documents.
For each document the following will be called, in this order:
observe_new_item
, with the path if it was computedwrite_all
will be called repeatedly with the contents of the itemobserve_end
, when the item is finished
The default implementation is to produce a stream of ndjson on an existing Write
impl.
Provided Methods
sourcefn observe_new_item(
&mut self,
path: &[Vec<u8>],
header_style: HeaderStyle
) -> Result<()>
fn observe_new_item(
&mut self,
path: &[Vec<u8>],
header_style: HeaderStyle
) -> Result<()>
Called when a new item is started.
path
will be empty if it is not being computed.
sourcefn observe_end(&mut self, header_style: HeaderStyle) -> Result<()>
fn observe_end(&mut self, header_style: HeaderStyle) -> Result<()>
Called when an item is finished.