pub struct Page {
pub focus: Vec<Seg>,
pub items: Vec<PageItem>,
pub title: Option<String>,
pub demoted: bool,
}Expand description
One container’s children, ready to render.
Fields§
§focus: Vec<Seg>The container being listed. Empty is the document root.
items: Vec<PageItem>§title: Option<String>What this page’s own container is called, when it is a sequence item and its index is not worth reading — the same title its row carried on the page you opened it from, so the breadcrumb agrees with what you clicked.
demoted: boolWhether this whole page sits under a demoted top-level key.
The page you reach by opening a demoted row. A frontend that folds its demoted items behind an “advanced” disclosure reads this to keep the framing once you are inside — the section a page came out of is still true of the page.
Implementations§
Source§impl Page
impl Page
pub fn is_empty(&self) -> bool
Sourcepub fn position_of(&self, path: &[Seg]) -> Option<usize>
pub fn position_of(&self, path: &[Seg]) -> Option<usize>
Where path sits in this page, if it is on it.
A compressed row answers for its whole chain: both the node it is
(exports) and the node it opens (exports.journal) find it, because
every caller is asking the same question — which row here corresponds to
that node — and for a chain the answer is the one row standing for all of
it. Identical to matching on the path alone for any row that is not
compressed, where the two are the same.
Sourcepub fn has_drills(&self) -> bool
pub fn has_drills(&self) -> bool
Whether any item on this page opens a page of its own.
A page with none is a leaf of the navigation, and — at the root — a
document with no depth to navigate at all, which is how a frontend knows
to spend the whole width on one pane instead of drawing an empty second
one. See Model::pages_would_degenerate.
Sourcepub fn has_choice(&self) -> bool
pub fn has_choice(&self) -> bool
Whether this page offers a choice — two rows or more.
What a pane full of it would be for. A frontend drawing a sidebar reads it to find out whether there is anything to select between: one row is a label, not a menu, and half a screen is a lot to spend on a label.
Sourcepub fn partitioned(&self) -> (Vec<&PageItem>, Vec<&PageItem>)
pub fn partitioned(&self) -> (Vec<&PageItem>, Vec<&PageItem>)
The page’s items in two stable runs: the ones a reader came to edit, then the demoted ones.
items stays in document order, because that order is the
document’s and flower does not get to reshuffle it. This is the one
rearrangement a settings menu does want — the “advanced” fold — offered
here rather than left to each frontend so they all fold at the same seam.
The partition is stable, and demotion is root-scoped, so a group header and the members inlined under it always land in the same run, adjacent and in order: the fold can never cut a group in half.
The page’s title as a breadcrumb — server › limits, or root_label for
the document root.