Skip to main content

Crate flower_core

Crate flower_core 

Source
Expand description

flower-core — the frontend-neutral structural editing model for config files.

Given a config document’s bytes and format, it exposes the document as a navigable projection of fig’s Value — plus structural navigation and path-addressed edits routed through fig’s lossless editor. It knows nothing about terminals, GUIs, or the filesystem — a frontend (flower-ratatui, a future flower-gpui, …) renders the projection and drives the model’s methods; the embedder owns file I/O.

There are two projections, selected by ViewMode, over one document and one set of edits:

  • the tree — every visible node at once, indented by depth (Model::rows). The document as a document.
  • the page — one container at a time, pushed and popped (Model::page), with containers that fit the InlineBudget inlined. The document as a settings menu, and the one that stays legible when it is deep — or, under a generous budget, the whole document on one page.

Re-exports§

pub use backend::Backend;
pub use backend::BackendError;
pub use backend::EditOp;
pub use backend::FigBackend;
pub use format::detect;
pub use model::Mode;
pub use model::Model;
pub use model::ViewMode;
pub use page::InlineBudget;
pub use page::ItemKind;
pub use page::Page;
pub use page::PageItem;
pub use schema::Constraint;
pub use schema::FieldRule;
pub use schema::FieldRuleExt;
pub use schema::Schema;
pub use tree::Row;
pub use tree::VKind;

Modules§

backend
The commit sink: what Model edits through.
format
Map a file path’s extension onto a fig::Format.
model
The frontend-neutral editor model and its structural operations.
page
The page projection: one level of the document at a time.
schema
flower-core’s own constraint vocabulary, plugged into fig-schema’s generic rule engine.
tree
The navigable view of a config document: a flat list of Rows derived from fig’s Value tree.

Structs§

Consequence
A cost of changing a field, declared on the rule that governs it.
PathPat
A path pattern. Unlike a concrete Seg path it can reach every element of a sequence (SegPat::EachItem), every entry of a mapping (SegPat::AnyKey), or a whole subtree (SegPat::AnyDepth), so a rule can constrain each item of a list field (tags:, audience:) or everything beneath a key.
Presentation
Presentation hints for one field rule.
Term
One term of a controlled vocabulary.

Enums§

Cardinality
Whether a reference or list-shaped field holds one entry or many. Pure data shape — reused by an embedder’s own reference/relation constraint (prov’s spanning/cardinality concepts, for instance) without this crate needing to know what a “relation” is.
FieldType
The type a field expects. Drives type-directed parsing and widget choice.
Icon
A semantic icon hint. Frontends map to their own symbol set.
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.
SegPat
One step of a PathPat.
Severity
What the host should do about a consequence — the interaction, not a measure of how bad it is. Mirrors Validation’s Ok/Warn/Reject: the crate names the response, the embedder renders it.
Tint
A semantic tint hint. Frontends map to theme-adaptive colours.
Validation
The result of validating a value against a field’s constraint at commit time.

Functions§

guards_without_terms
Guards that name a value the vocabulary doesn’t have — a lint, run when an embedder loads its schema, not part of validation.