pub struct PageItem {
pub path: Vec<Seg>,
pub label: String,
pub vkind: VKind,
pub preview: String,
pub kind: ItemKind,
pub inset: usize,
pub title: Option<String>,
pub descend_to: Vec<Seg>,
pub demoted: bool,
pub summary: Option<String>,
}Expand description
One line of a page.
Fields§
§path: Vec<Seg>The fig path to this node from the document root — the same currency
tree deals in, so an edit op takes it unchanged.
label: StringThe mapping key, or [i] for a sequence item.
vkind: VKind§preview: StringA one-line rendering of the value (the scalar text, or {n} / [n]).
kind: ItemKind§inset: usize0 for a direct child of the page’s focus; 1 for a member of a group
inlined into it, and one more for each further rank the InlineBudget
admitted. Bounded by InlineBudget::depth, so the default budget never
goes past 1.
title: Option<String>A readable stand-in for a sequence item’s index — the value of whichever
of its fields best names it (title_keys). None for a mapping entry,
whose key already names it, and for an item nothing distinguishes.
It never replaces label: the index is what the path is
addressed by and what a reorder moves, so a frontend shows both.
descend_to: Vec<Seg>Where opening this row lands, when the pages between here and there would each list nothing but the next step down.
Equal to path for almost every row. It differs for a
compressed drill — exports › journal, one row standing for a chain
of containers that hold only each other — where it is the deepest of
them, the first one whose page has something to say.
path stays the outermost node, so every op still takes it
unchanged and none of them needed a special case: deleting the row
removes the whole chain (which is what deleting something called
exports › journal should do, and leaves no empty husk behind), and
renaming it renames exports. Only opening looks here.
demoted: boolWhether this item belongs below the fields a reader came here to edit — a page’s own “advanced” section, in the sense a settings menu means it.
Set by the embedder’s demoted-key set, and root-scoped exactly as
build_page’s hiding is: it is a property of the whole subtree under a
top-level key, so every item on a demoted container’s page is demoted too
and the section cannot come apart when you drill into it.
A demotion, not a hiding and not a lock: the item renders, carries its path, and takes every op the others take. It says only that a reader scanning for the field they meant to change should not have to read past this one to find it.
summary: Option<String>A container’s entire contents in flow form ({branches: [main]}), when
they are short enough to be worth showing instead of counting.
1 field › is strictly less than the document says: the field is right
there and it fits. A count is what you fall back to when the contents
don’t (SUMMARY_BUDGET), not the default way to describe a small
container. None for a scalar, whose value is already its own row.
Implementations§
Source§impl PageItem
impl PageItem
Sourcepub fn is_drill(&self) -> bool
pub fn is_drill(&self) -> bool
Whether activating this item opens a page (rather than editing a value).
A group header does not, though it names a container: its members are already on this page, so the page it would open shows exactly what you can already see — the same two rows twice, once on each side of a split. A container is worth a page when the page tells you something; this one cannot. Its members are reached by moving onto them, and every op that takes the group itself takes a path, which the header still carries.
Sourcepub fn is_container(&self) -> bool
pub fn is_container(&self) -> bool
Whether this item names a container at all — a drill row, or the header of a group inlined into this page.
pub fn is_scalar(&self) -> bool
Sourcepub fn can_rename(&self) -> bool
pub fn can_rename(&self) -> bool
Whether this item’s label can be changed — true for a mapping entry, false for a sequence item.
A sequence item’s label is its index: it is the position, not a name, so there is nothing to rename and the only thing that moves it is a reorder. The inference is one line, which is exactly why it belongs here — every frontend that redid it would be one edit away from disagreeing with the op that actually refuses.
Sourcepub fn is_compressed(&self) -> bool
pub fn is_compressed(&self) -> bool
Whether this row stands for a chain of containers rather than for one
(descend_to).
Sourcepub fn chain_labels(&self) -> Vec<String>
pub fn chain_labels(&self) -> Vec<String>
The names this row shows, outermost first — ["exports", "journal"] for a
compressed drill, and just the label for every other row. A frontend joins
them with whatever separator its breadcrumb uses.