pub struct NdjsonWriter<'w, W: Write> { /* private fields */ }Expand description
Writer for Newline-Delimited JSON (NDJSON) format.
NDJSON is ideal for streaming large datasets where each line is a
complete JSON object. This allows easy processing with tools like
jq, grep, or streaming parsers.
Implementations§
Source§impl<'w, W: Write> NdjsonWriter<'w, W>
impl<'w, W: Write> NdjsonWriter<'w, W>
Sourcepub fn with_flush_interval(self, interval: usize) -> Self
pub fn with_flush_interval(self, interval: usize) -> Self
Set the flush interval.
Sourcepub fn write_item<T: Serialize>(&mut self, item: &T) -> Result<(), ReportError>
pub fn write_item<T: Serialize>(&mut self, item: &T) -> Result<(), ReportError>
Write a single item as a JSON line.
Sourcepub fn write_tagged<T: Serialize>(
&mut self,
tag: &str,
item: &T,
) -> Result<(), ReportError>
pub fn write_tagged<T: Serialize>( &mut self, tag: &str, item: &T, ) -> Result<(), ReportError>
Write a tagged item (with a type field).
Sourcepub fn write_diff_components(
&mut self,
result: &DiffResult,
) -> Result<(), ReportError>
pub fn write_diff_components( &mut self, result: &DiffResult, ) -> Result<(), ReportError>
Write all components from a diff result.
Sourcepub fn write_diff_vulnerabilities(
&mut self,
result: &DiffResult,
) -> Result<(), ReportError>
pub fn write_diff_vulnerabilities( &mut self, result: &DiffResult, ) -> Result<(), ReportError>
Write all vulnerabilities from a diff result.
Sourcepub fn write_diff_report(
&mut self,
result: &DiffResult,
old_sbom: &NormalizedSbom,
new_sbom: &NormalizedSbom,
config: &ReportConfig,
) -> Result<(), ReportError>
pub fn write_diff_report( &mut self, result: &DiffResult, old_sbom: &NormalizedSbom, new_sbom: &NormalizedSbom, config: &ReportConfig, ) -> Result<(), ReportError>
Write a complete diff report in NDJSON format.
The first line is metadata, then components, then vulnerabilities.
Sourcepub const fn items_written(&self) -> usize
pub const fn items_written(&self) -> usize
Get the number of items written.
Auto Trait Implementations§
impl<'w, W> Freeze for NdjsonWriter<'w, W>
impl<'w, W> RefUnwindSafe for NdjsonWriter<'w, W>where
W: RefUnwindSafe,
impl<'w, W> Send for NdjsonWriter<'w, W>where
W: Send,
impl<'w, W> Sync for NdjsonWriter<'w, W>where
W: Sync,
impl<'w, W> Unpin for NdjsonWriter<'w, W>
impl<'w, W> UnsafeUnpin for NdjsonWriter<'w, W>
impl<'w, W> !UnwindSafe for NdjsonWriter<'w, W>
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<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>
Converts
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>
Converts
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