Expand description
Declarative lens DSL for panproto.
Provides a human-readable specification format for lenses, protolenses,
and related optical constructs. Supports Nickel (.ncl), JSON, and YAML
surface syntax. Nickel is the primary authoring format, providing typed
contracts for validation, record merge for fragment composition, functions
for parameterized templates, and imports for modularity.
§Evaluation pipeline
- Surface syntax (Nickel/JSON/YAML) is evaluated to a normalized record
- The record is deserialized into a
LensDocument - The document is compiled to a
ProtolensChain+FieldTransforms
§Example
use panproto_lens_dsl::{load, compile};
let doc = load(std::path::Path::new("my_lens.ncl")).unwrap();
let compiled = compile(&doc, "record:body", &|_| None).unwrap();
// compiled.chain is a ProtolensChain ready for instantiation
// compiled.field_transforms are value-level transformsRe-exports§
pub use compile::CompiledLens;pub use document::Constraint;pub use document::HintSpec;pub use document::HintStringency;pub use document::LensDocument;pub use document::PreferencePredicate;pub use error::LensDslError;
Modules§
- compile
- Unified compilation dispatcher.
- compose
- Lens composition via named references.
- document
- Serde-compatible types for the lens DSL document format.
- error
- Error types for the lens DSL.
- eval
- Evaluation of Nickel, JSON, and YAML sources into
LensDocument. - rules
- Compilation of pattern-match rewrite rules to lens steps.
- steps
- Compilation of step pipelines to
ProtolensChainandFieldTransforms.
Structs§
- Load
DirResult - Result of loading a directory of lens documents.
Functions§
- compile
- Compile a
LensDocumentto aCompiledLens. - load
- Load a lens document from a file.
- load_
and_ compile - Load a lens file and compile it in one step.
- load_
dir - Load all lens documents from a directory.