Skip to main content

RecordsToJson

Struct RecordsToJson 

Source
pub struct RecordsToJson<S: Sink> { /* private fields */ }
Expand description

Turns TableRows/1 into JsonEvents/1.

Schema opens the array, each Row is one object whose members are the labels in schema order, End closes the array and ends the document. The protocol is validated as the CSV renderer validates it: one schema first, rows of the schema’s width, one end, PROTOCOL_ORDER_ERROR otherwise. A schema with no columns is allowed, since an empty object is a JSON value; the CSV renderer’s refusal is about CSV. When a label repeats, each record carries it once, from the last column whose cell contributes a member (under Skip a Missing cell contributes none), in that column’s position: the value a reader of the un-deduplicated record would keep, since a member that was never written cannot win. A failure found after events were forwarded is marked as having committed output, since the stage downstream may have rendered them.

Implementations§

Source§

impl<S: Sink> RecordsToJson<S>

Source

pub fn new(sink: S) -> Self

Source

pub fn with_missing(self, missing: MissingRecord) -> Self

Source

pub fn rows(&self) -> u64

Rows emitted so far.

Source

pub fn is_done(&self) -> bool

Whether End has been forwarded.

Source

pub fn into_inner(self) -> S

Trait Implementations§

Auto Trait Implementations§

§

impl<S> Freeze for RecordsToJson<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for RecordsToJson<S>
where S: RefUnwindSafe,

§

impl<S> Send for RecordsToJson<S>
where S: Send,

§

impl<S> Sync for RecordsToJson<S>
where S: Sync,

§

impl<S> Unpin for RecordsToJson<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for RecordsToJson<S>
where S: UnsafeUnpin,

§

impl<S> UnwindSafe for RecordsToJson<S>
where S: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.