Expand description
Source-level document representation with layout metadata.
Used for programmatic construction of Eure documents with preserved formatting information (comments, section ordering, etc.). Source-level document representation for programmatic construction and formatting.
This module provides types for representing Eure source structure with layout metadata,
while actual values are referenced via [NodeId] into an [EureDocument].
§Design
┌─────────────────────────────────────────────┐
│ SourceDocument │
│ ┌─────────────────┐ ┌──────────────────┐ │
│ │ EureDocument │ │ Layout │ │
│ │ ┌───────────┐ │ │ │ │
│ │ │ NodeId(0) │◄─┼──┼─ Binding.node │ │
│ │ │ NodeId(1) │◄─┼──┼─ Binding.node │ │
│ │ │ NodeId(2) │◄─┼──┼─ Binding.node │ │
│ │ └───────────┘ │ │ │ │
│ └─────────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────┘- EureDocument: Holds semantic data (values)
- Layout: Holds presentation metadata (comments, ordering, section structure)
§Example
ⓘ
// Convert from TOML, preserving comments and section ordering
let source = eure_toml::to_source_document(&toml_doc);
// Modify values (layout is preserved)
let node = source.find_binding(&["server", "port"]).unwrap();
source.document.node_mut(node).set_primitive(8080.into());
// Format to Eure string
let output = eure_fmt::format_source(&source, &config);Structs§
- Array
Element Layout - Layout information for an array element.
- Layout
- Layout information describing how to render the document.
- Source
Document - A document with layout/presentation metadata.
- Source
Path Segment - A segment in a source path.
Enums§
- Comment
- A comment in the source.
- Layout
Item - An item in the layout.
- Section
Body - The body of a section.
- Source
Key - A key in source representation.
Type Aliases§
- Source
Path - A path in source representation.