Skip to main content

Module tree

Module tree 

Source
Expand description

The navigable view of a config document: a flat list of Rows derived from fig’s Value tree.

Each row carries its fig path — a Vec<Seg> of mapping keys and sequence indices from the document root. That path is exactly what fig::Editor’s ops take (&[fig::Segment]), so navigation and editing speak the same language: move the selection to a row, then hand its path straight to replace_value / delete / remove_item / … .

Flattening (rather than bough’s recursive path-arithmetic over a nested tree) keeps j/k navigation a single index step and naturally handles the fact that a config path interleaves keys and indices.

Structs§

Row
One visible line of the tree.

Enums§

Seg
One step of a fig path: a mapping key or a sequence index. Owned (unlike fig::Segment<'a>, which borrows), so a path can outlive a single FFI call.
VKind
The value kind of a row, for styling and container logic.

Functions§

build_rows
Build the flat row list from a document root, honoring the collapsed set (paths whose containers are collapsed) and a set of top-level mapping keys to hide.
edit_seed
The editable text a scalar starts with when you enter edit mode.
map_keys
The mapping keys at path, in document order. None when the path doesn’t resolve or names something that isn’t a mapping.
parse_scalar
Parse an edit-buffer string into a Value, inferring type by literal shape. A prototype heuristic — a schema layer would instead pick the type the key expects and validate against it. fig’s editor reparse is the backstop: a value that can’t splice validly is rejected and rolled back.
preview
A compact one-line preview of a value.
seq_len
The length of the sequence at path. None when the path doesn’t resolve or names something that isn’t a sequence — the two cases a caller sizing an append index or a reorder permutation has to tell apart from an empty list.
to_fig
Borrow an owned path as fig’s Segment slice for an editor call.
value_at
The node a fig path names in root, or None when the path doesn’t resolve. The empty path is the root itself.