pub struct NdjsonStreamingSink<T> { /* private fields */ }Expand description
Newline-Delimited JSON (NDJSON) streaming sink.
Each item is written as a separate JSON object on its own line:
{"field": "value1"}
{"field": "value2"}This format is ideal for streaming and processing line by line.
§Type Parameters
T- The type of items to write. Must implementSerialize.
Implementations§
Source§impl<T: Serialize + Send> NdjsonStreamingSink<T>
impl<T: Serialize + Send> NdjsonStreamingSink<T>
Sourcepub fn new(path: PathBuf) -> SynthResult<Self>
pub fn new(path: PathBuf) -> SynthResult<Self>
Sourcepub fn bytes_written(&self) -> u64
pub fn bytes_written(&self) -> u64
Returns the total bytes written.
Trait Implementations§
Source§impl<T: Serialize + Send> StreamingSink<T> for NdjsonStreamingSink<T>
impl<T: Serialize + Send> StreamingSink<T> for NdjsonStreamingSink<T>
Source§fn process(&mut self, event: StreamEvent<T>) -> SynthResult<()>
fn process(&mut self, event: StreamEvent<T>) -> SynthResult<()>
Processes a stream event.
Source§fn flush(&mut self) -> SynthResult<()>
fn flush(&mut self) -> SynthResult<()>
Flushes any buffered data.
Source§fn close(self) -> SynthResult<()>
fn close(self) -> SynthResult<()>
Closes the sink and releases resources.
Source§fn items_processed(&self) -> u64
fn items_processed(&self) -> u64
Returns the number of items processed.
Auto Trait Implementations§
impl<T> Freeze for NdjsonStreamingSink<T>
impl<T> RefUnwindSafe for NdjsonStreamingSink<T>where
T: RefUnwindSafe,
impl<T> Send for NdjsonStreamingSink<T>where
T: Send,
impl<T> Sync for NdjsonStreamingSink<T>where
T: Sync,
impl<T> Unpin for NdjsonStreamingSink<T>where
T: Unpin,
impl<T> UnsafeUnpin for NdjsonStreamingSink<T>
impl<T> UnwindSafe for NdjsonStreamingSink<T>where
T: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.