Skip to main content

Crate synx_format

Crate synx_format 

Source

Modules§

binary
SYNX Binary Format (.synxb) — compact binary serialization with string interning.
diff
Structural diff between two SYNX values.
schema_json
Build JSON Schema from !active Constraints and validate Value instances (optional jsonschema feature).
synxl
SYNXL — “SYNX Lines”: the record-stream counterpart of JSONL and CSV.

Structs§

Constraints
Constraints from [min:3, max:30, required, type:int].
Diagnostic
One diagnostic: record index (0-based), source line (1-based), kind, and a human-readable message (§11.2).
DiffChange
A single changed key with its previous and new value.
DiffResult
Result of a structural diff between two SYNX objects.
FieldDecl
One declaration from a !fields line: name(type)[constraints].
FieldList
The ordered fields in effect for a run of records (§5).
IncludeDirective
Include directive: !include path [alias]
Meta
Metadata for a single key (markers, args, constraints).
Options
Options for active mode resolution.
ParseResult
Full parse result with metadata.
ParserOptions
Options for a single parse_with run.
Synx
Main entry point for the SYNX parser.
SynxlDocument
A fully materialised SYNXL document.
SynxlError
A hard error (§11.1) with the 1-based source line that produced it.
SynxlOptions
Parse options. Defaults follow §8.4: validation is opt-in.
SynxlReader
Streaming record reader over borrowed text (§15.1).
SynxlReaderOwned
Streaming record reader that owns its document (§15.1).
SynxlRecord
One record produced by SynxlReader.
SynxlStreamReader
Streaming record reader over an [io::BufRead] — the reader §15.1 asks for.
UseDirective
Use directive: !use @scope/name [as alias]

Enums§

DiagnosticKind
Recoverable parse observations (§11.2). Reported, never dropped silently.
Mode
File mode.
SynxlErrorKind
Hard-error conditions (§11.1). Every one of these aborts the parse; no partial result is produced.
SynxlStreamError
What can go wrong while streaming from an [io::BufRead].
Value
SYNX value types.

Functions§

diff_objects
Compute a structural diff between two SYNX objects (top-level keys).
diff_to_value
Convert a DiffResult into a Value::Object suitable for JSON serialisation.
metadata_to_json_schema
Build a draft 2020-12 JSON Schema object from ParseResult::metadata.
parse
Parse a SYNX text string into a value tree with metadata.
parse_lines
Parse a whole SYNXL document (§4–§10).
parse_lines_with
parse_lines with explicit options (§8.4).
parse_with
Parse a SYNX text string with explicit ParserOptions.
records_to_json_array
Canonical JSON array projection of a record slice (§12.1).
records_to_ndjson
Canonical NDJSON projection of a record slice (§12.2): one canonical object per line, LF-separated, no enclosing array.
reshape_tool_output
Reshape parsed tree for !tool mode.
resolve
Resolve all active-mode markers in a ParseResult. Returns the resolved root Value.
safe_calc
Safely evaluate an arithmetic expression. All variable references must be substituted with numbers before calling this.
to_json
Convert a Value to a JSON string.
value_to_json_value
Convert a parsed SYNX Value tree to serde_json::Value for JSON Schema tooling.
write_document
Serialize a document, emitting a !fields line per run of records that share a field list (§14, §4.2).
write_json
Write a Value as JSON string (for FFI output).
write_lines
Serialize a single-schema record set (§14). See write_document for the failure condition.

Type Aliases§

MetaMap
Map of key → metadata for one object level.