Module eite

Source
Expand description

Implementation of EITE formats (Rust translation – high‑level export / import wrappers).

This module exposes a small public convenience surface for converting between “Dc array” document representations (Vec<u32>) and external serialized formats (bytes) plus a transformation hook. The heavy‑lifting implementations live in sub‑modules.

As EITE did not have all intended elements fully implemented, this Rust version similarly has some limitations.

Primary entry points provided here:

These are intentionally thin wrappers delegating to lower‑level functions so that callers have a stable, ergonomic API while internal modules evolve.

§Errors

All fallible operations return anyhow::Result<_>. Under the hood some modules may surface structured errors (e.g. an internal EiteError enum); those are converted into anyhow::Error at this boundary. Panics are avoided unless a genuine invariant violation occurs (logic error / programmer bug).

§Concurrency

The underlying state object (EiteState) is passed in mutably for import / export because format conversion may accumulate warnings, cache dataset lookups, or modify configuration state required for subsequent operations. Pure transformations only need an immutable reference (and could, if required later, be made fully independent of state when transformation semantics are guaranteed to be stateless).

§Testing

This file includes light “sanity” unit tests that verify:

  • Wrapper identity / invariants (e.g. import_and_export equivalence with a separate import_document + export_document sequence).
  • Transformation pass‑through for currently identity‑like transformations (semanticToText, codeToText).
  • Basic error expectations (unknown transformation).

For deeper behavioral validation (round‑tripping every supported format, exhaustive edge cases, dataset driven conversions, escaping, etc.) see the dedicated tests housed alongside the lower‑level modules.

§Performance

These wrappers add effectively zero overhead beyond an extra function call. When profiling, attribute time spent within these wrappers to the delegated modules (formats, encoding, transform, etc.).

Modules§

dc
eite_state
encoding
exceptions
formats
EITE format compatibility module. Provides conversions and metadata for document character (Dc) arrays and external formats. This module supports parsing, converting, and serializing Dc arrays to and from various external formats, as well as providing metadata and handling warnings for import and export operations.
kv
runtime
settings
terminal
transform
util

Functions§

export_document
Export a document (Dc array) into a named external format.
import_and_export
Convenience: import from one format and export to another in a single step.
import_document
Import a document from a named external format into a Dc array.
transform_document
Apply an in‑memory document transformation (Dc array -> Dc array).