pub struct Element {
pub kind: String,
pub data: BTreeMap<String, String>,
}Expand description
A line’s classification — kind + an open, preset-defined data map
(docs/prose-dialect-spec.md §7/§3.5b, §3.6, sitting-5 ruling item 8:
“the output format bakes no scene-specific fields — element data is an
open map produced by conventions and handlers”). Deliberately a String
kind, not a closed enum: the vocabulary belongs to whichever preset or
@[element] handler classified the line, never to the runtime.
data is real (issue #2108, docs/decision-log.md 2026-08-03 “The
element output model: attachment is block-level metadata, delivery is
per-line”): an attach = StructName convention handler’s claimed line
consumes itself (no event — item 6, “AN EVENT EXISTS IFF A LINE EXISTS”)
and its returned struct’s fields merge into data on every line in the
run that follows (item 3: multiple attach handlers, e.g. cue then
parenthetical, accumulate onto the same run). kind stays the
degenerate Self::NARRATIVE regardless — classifying kind itself
for a non-attach single-line handler (heading/transition reporting
their own handler name as kind) is a distinct, still-open gap; see
issue #2108’s own follow-up notes. A line with no preceding attach
convention still reports the always-correct Element::narrative.
Fields§
§kind: StringThe classifying handler’s name, or Self::NARRATIVE for an
ordinary, unclassified line — always the latter today, see this
type’s own doc.
data: BTreeMap<String, String>Open, handler-defined payload. Empty when no attach convention
preceded this line.
Implementations§
Source§impl Element
impl Element
Sourcepub const NARRATIVE: &'static str = "narrative"
pub const NARRATIVE: &'static str = "narrative"
The degenerate kind every line reports today — docs/prose-dialect-spec.md
§7’s own superset check: “schema-less ink → element: narrative, parts: [Text]” (§1 puts it the same way: “the degenerate case —
an untyped narrative element with no spans”).