Skip to main content

Crate tabnas_render

Crate tabnas_render 

Source
Expand description

Renderers for the tabnas transducer protocols.

A renderer decides how a semantic protocol becomes text: TableRows/1 becomes CSV, JsonEvents/1 becomes JSON, incrementally, through a coalescing writer with a byte budget. Source interpretation never crosses into this crate: a renderer sees labels and cells, never paths.

  • text: TextOut, the fragment boundary every renderer writes to; WriteOut, which coalesces fragments to a byte budget, enforces max_output_bytes and counts output_bytes; StringOut for tests and small results; Join and ReplaceText, the two text combinators whose correctness depends on chunk boundaries, and Concat, a Join with no separator under the name the language gives it.
  • csv: CsvRenderer, the always-quoted profile of TableRows/1, with CsvOptions for the dialects.
  • json: JsonRenderer, JsonEvents/1 as compact or indented JSON text.
  • records: RecordsToJson, TableRows/1 as JsonEvents/1, an array of objects keyed by label.
  • number: the JSON number grammar both renderers hold lexemes to.
  • renderers: RenderRenderers, this crate’s implementation of alchemy’s Renderers, the interface a compiled alchemy program makes its rendering stages through.

The protocols, the text boundary TextOut and the renderers’ options are tabnas-alchemy’s shared types (tabnas_alchemy::shared), re-exported here at the paths they have always had. Every renderer validates its protocol as it goes and reports the stable codes of tabnas_alchemy::shared::Code; the output is flushed once, at the protocol’s end, and a failure found after text was written says so with committed_output.

Re-exports§

pub use csv::CsvRenderer;
pub use json::JsonRenderer;
pub use number::is_json_number;
pub use records::MissingRecord;
pub use records::RecordsToJson;
pub use renderers::renderers;
pub use renderers::RenderRenderers;
pub use text::Concat;
pub use text::Join;
pub use text::ReplaceText;
pub use text::StringOut;
pub use text::WriteOut;
pub use text::DEFAULT_BUDGET;

Modules§

csv
TableRows/1 as CSV: the always-quoted profile.
json
JsonEvents/1 as JSON text.
number
Number text, shared by the renderers.
records
TableRows/1 as JsonEvents/1: an array of records keyed by label.
renderers
This crate’s implementation of alchemy’s Renderers: the interface a compiled alchemy program makes its rendering stages through.
text
Text output: where rendered fragments go.

Structs§

CsvOptions
The CSV dialect, which is one of alchemy’s shared types. The CSV dialect.
JsonOptions
The JSON profile, which is one of alchemy’s shared types. The JSON profile.

Enums§

MissingText
The CSV dialect, which is one of alchemy’s shared types. What a Cell::Missing becomes.
Newline
The CSV dialect, which is one of alchemy’s shared types. The record terminator.
Quoting
The CSV dialect, which is one of alchemy’s shared types. When a field is quoted.

Constants§

VERSION
This crate’s version, as Cargo.toml declares it.

Traits§

TextOut
The fragment boundary every renderer writes to, which is one of alchemy’s shared types. A consumer of text fragments.