#[non_exhaustive]pub struct FlatNode {Show 14 fields
pub id: NodeId,
pub parent: Option<NodeId>,
pub first_child: Option<NodeId>,
pub next_sibling: Option<NodeId>,
pub span: Range<usize>,
pub content_span: Option<Range<usize>>,
pub level: Option<u32>,
pub kind: String,
pub text: Option<String>,
pub destination: Option<String>,
pub head: Option<bool>,
pub alignment: Option<Alignment>,
pub name: Option<String>,
pub attrs: Vec<(String, Option<String>)>,
}Expand description
One node of an Editor::nodes snapshot — the flat AST arena as owned Rust
data (the JSON-free read path). id indexes the snapshot; parent,
first_child, and next_sibling link the tree (None where absent).
text is the node’s primary payload (a str’s bytes, a code_block’s
body, …) and destination a link/image target, each None when the kind
carries no such payload.
#[non_exhaustive]: a snapshot node is something twig hands you, never
something you build, so it gains a field whenever a node kind’s payload is
surfaced (as head/alignment were for tables). Sealing construction here
keeps every future addition a minor release instead of a major one.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.id: NodeId§parent: Option<NodeId>§first_child: Option<NodeId>§next_sibling: Option<NodeId>§span: Range<usize>§content_span: Option<Range<usize>>§level: Option<u32>A heading’s level; None for every other kind.
kind: String§text: Option<String>§destination: Option<String>§head: Option<bool>Whether a row/cell belongs to the table head; None for every other
kind.
alignment: Option<Alignment>A cell’s column alignment; None for every other kind. The delimiter
row (|:--|--:|) that spells the alignment out is consumed by the parser
and has no node of its own, so this is the only way to recover it.
Alignment::Default is a real, unspecified alignment (a bare ---) —
distinct from the None a non-cell node reports.
name: Option<String>A generic element’s tag name ("picture", "source", …); None for
every semantic kind (whose identity is kind alone). With this an
html_elements parse’s <picture>/<source> are distinguishable — both
report kind == "element".
attrs: Vec<(String, Option<String>)>The node’s {...} / HTML attributes as (key, value) pairs in source
order (empty when it has none). A bare attribute (HTML disabled, or a
<source media=…> used as a flag) has a None value.