Skip to main content

Crate dms

Crate dms 

Source
Expand description

DMS parser — full spec v0.14.

Modules§

tier1
Tier-1 module — decorators, dialects, and the t1 decoder/encoder.
tier1_stream
Tier-1 streaming decoder — separate from the batch path so the main decode_t1 flow stays untouched. This module post-processes a fully-decoded DocumentT1 into an iterator of StreamEvents following TIER1.md §“Streaming / incremental decode” yield-point semantics.

Structs§

AttachedComment
A comment plus its attachment metadata.
Comment
One captured comment.
DecodeError
Document
A parsed DMS document — body value plus optional front matter table.
HeredocModifierCall
IndexMap
A hash table where the iteration order of the key-value pairs is independent of the hash values of the keys.

Enums§

BreadcrumbSegment
One step in a comment-attachment breadcrumb path.
CommentKind
Whether a comment was a #/// line comment or a ### ### / /* */ block comment.
CommentPosition
How a comment attaches to its target node.
EmitMode
Mirror of ParseMode for the emitter side.
EncodeError
Errors raised by the encode (emitter) path. Currently the only failure mode is full-mode emit refusing a Document that contains an unordered table — see SPEC §“Unordered tables”. Lite-mode emit (encode_lite) cannot fail and accepts unordered Documents.
HeredocFlavor
OriginalLiteral
Per-node literal-form record, captured during decoding so that encode can re-emit the value in the same source form (integer base, string flavor, heredoc modifiers). Keyed off the node’s path in Document::original_forms. Spec §encode.
ParseMode
Parse mode — full preserves comments and original literal forms; lite skips that bookkeeping. See SPEC §Parsing modes — full and lite. Same grammar, same errors; only the round-trip metadata differs.
StringForm
Value

Constants§

SUPPORTS_IGNORE_ORDER
Capability advertisement — this port ships unordered-table decode mode. See SPEC §Unordered tables. Unordered mode is optional to ship; callers probe this before opting in via decode_document_unordered / decode_lite_document_unordered.
SUPPORTS_LITE_MODE
Capability advertisement — this port ships lite-mode decode + lite-mode encode. See SPEC §Parsing modes — full and lite. Lite mode is optional to ship; callers can probe this constant before opting in via decode_lite_document / encode_lite.

Functions§

decode
Decode a DMS source string and return only the body. Front matter, if present, is decoded and validated (illegal declarations error), then discarded. SPEC v0.14 canonical name (replaces parse).
decode_document
Decode a full DMS document, returning body + front-matter metadata
decode_document_unordered
Full-mode decode with the unordered table backing — every Value::Table is replaced by Value::UnorderedTable (a plain HashMap, no insertion-order tracking). See SPEC §“Unordered tables”. Front matter remains ordered (per spec — meta is small and is consumed strictly).
decode_document_with_mode
Decode with explicit mode selection.
decode_document_with_options
Decode with explicit mode and ordering selection. When ignore_order=true, body tables are built as Value::UnorderedTable (HashMap-backed); when false, as Value::Table (IndexMap-backed, insertion-order preserved). See SPEC §“Unordered tables”.
decode_front_matter
Front-matter-only decode. Scans leading trivia, the opening +++, the front-matter contents, and the closing +++, then stops — body bytes are NOT tokenized. Required at SPEC tier 0; see SPEC §“Front-matter-only decode” for the full contract.
decode_lite
Lite-mode body-only decode. Equivalent to decode_lite_document(src)?.body, but returns only the body. Use when you don’t need front matter either.
decode_lite_document
Lite-mode Document decode. Body + front matter, no comment AST, no original_forms. The returned Document is not suitable for encode round-trip — see SPEC §Parsing modes — full and lite.
decode_lite_document_unordered
Lite-mode decode with the unordered table backing. The (unordered, lite) combo is the fastest read-only path: hash-only table backing + no comment/original-form bookkeeping. See SPEC §“Unordered tables”.
encode
Re-emit a decoded Document as DMS source. See SPEC §encode.
encode_lite
Lite-mode encode — emits the same data tree in canonical form: comments are dropped, integers are emitted in decimal regardless of source base, strings are emitted in basic-quoted form regardless of source flavour. Accepts both full-mode and lite-mode decoded Documents — the comments and original_forms fields are simply ignored. See SPEC §encode.
encode_with_mode
Mode-parameterised encode. EmitMode::Full matches encode() (and can fail with EncodeError::UnorderedInFullMode); EmitMode::Lite matches encode_lite() (always Ok). See SPEC §encode.
parseDeprecated
Deprecated alias for decode. Removed in v0.15.
parse_documentDeprecated
Deprecated alias for decode_document. Removed in v0.15.
parse_document_unorderedDeprecated
Deprecated alias for decode_document_unordered. Removed in v0.15.
parse_document_with_modeDeprecated
Deprecated alias for decode_document_with_mode. Removed in v0.15.
parse_document_with_optionsDeprecated
Deprecated alias for decode_document_with_options. Removed in v0.15.
parse_liteDeprecated
Deprecated alias for decode_lite. Removed in v0.15.
parse_lite_documentDeprecated
Deprecated alias for decode_lite_document. Removed in v0.15.
parse_lite_document_unorderedDeprecated
Deprecated alias for decode_lite_document_unordered. Removed in v0.15.
to_dmsDeprecated
Deprecated alias for encode. Removed in v0.4.
to_dms_liteDeprecated
Deprecated alias for encode_lite. Removed in v0.4.
to_dms_with_modeDeprecated
Deprecated alias for encode_with_mode. Removed in v0.4.

Type Aliases§

DmsHashMap
HashMap specialization used by unordered body tables, opt-in via decode_document_unordered / decode_lite_document_unordered (or the --ignore-order CLI flag). Iteration order is arbitrary — see SPEC §“Unordered tables”. Reuses DmsHasher so the hasher is the same as the ordered side; the only difference is the lack of the IndexMap’s entry-order Vec<usize> bookkeeping.
DmsMap
IndexMap specialization used for body tables and front matter. Hasher is swappable via the fast_hash cargo feature.
ParseErrorDeprecated
Deprecated alias for DecodeError. Removed in v0.4.