Skip to main content

Crate edikt_env

Crate edikt_env 

Source
Expand description

edikt .env / .properties format module.

Flat, string-valued, honest line-level editing only: no grammar, no interpolation, no quoting semantics, no inline comments. key=value / key:value entries, #/! comments, and blanks round-trip byte-for-byte. Paths are a single .key; edits change only the targeted value or line.

Macros§

json
Construct a Value from JSON-ish literal syntax.

Structs§

Commented
A Value enriched with per-node comments: what conversion carries so a commented source survives -T into a commented target.
EditError
A format-preserving edit failure (bad path, wrong type for the operation, unsupported construct).
Env
A parsed .env / .properties document, backed by a lossless CST.
ParseError
A parse failure.

Enums§

CommentKind
One of the three comment kinds in the uniform model. Which kinds a format supports is its comment capability: each format declares a COMMENT_KINDS: &[CommentKind] (empty => no comments, subsuming the boolean Feature::Comments). The # accessor addresses a node’s comment by kind.
Dialect
Which separator spelling a document uses.
Expr
An expression node.
Feature
A capability a config format may or may not support.
Step
One navigation step within a path, applied to the current input.
Value

Constants§

COMMENT_KINDS
Comment kinds this format supports (empty => none); the comment capability, subsuming the boolean Feature::Comments. No inline: a # inside a value is data, not a comment.
FEATURES
Capabilities: comments only. Flat and string-valued: no nesting, arrays, typed scalars, or sections.

Traits§

Document
A parsed config document.

Functions§

apply
emit
Emit a value as a flat .env: every leaf becomes a key=value line, with nested objects/arrays flattened to dotted keys. Returns the text and warnings. (The comment-free case of emit_commented.)
emit_commented
Emit a commented value as a flat .env: every leaf becomes a key=value line (nesting flattened to dotted keys), head/foot comments as # lines. An inline comment can’t exist here, so it moves to a head line of its own - with a warning, since that is a remap, not a placement.
emit_commented_with
As emit_commented, writing the separator dialect spells.
parse
Parse .env / .properties source into an Env document.
parse_expr
Parse a complete expression, consuming all of src.
parse_spaced
Parse space-separated key value source (sshd_config-shaped) into an Env document.
parse_with
Parse with an explicit Dialect.