Skip to main content

Crate bern_ir

Crate bern_ir 

Source
Expand description

Bern’s intermediate representation.

The IR states cross-platform semantics only: no DOM, SwiftUI, GTK or WinUI types appear here. Every target module consumes the same Application and decides privately how to realize it.

Modules§

spec
Built-in component specifications.
style
Style overrides and motion tokens declared with style!.

Structs§

AppInfo
Application
CloseCheck
The close check of a window. When when holds, closing waits for a decision: Save (running save), Discard or Cancel. The expressions are evaluated against the closing window’s own session drafts.
ComponentDef
ComponentLibrary
Versioned description of a component library crate, generated from its sources. Applications check it against their own configuration before using its components: descriptor and IR versions, the crate version it was generated from, and translations for every required language.
ComponentRef
Element
Exemption
A platform on which a feature need not be reachable, with the reason.
Expr
A type-checked restricted expression.
FeatureContract
A #[bern::features] contract: what users can do within the scope of one component, and how each feature is reached in each layout size.
FeatureDef
FieldRef
A writable session field bound to a control.
IfLetNode
IfNode
Languages
LayoutConfig
Breakpoints choosing between layout sizes, from [layouts].
MatchArm
MatchBinding
MatchNode
ParamDef
PlayerDef
An application player from the #[bern::players] catalog. Its id is the stable player_id every entry uses.
QueryBinding
A query of the engine catalog bound with its arguments. The arguments are restricted expressions; when their values change, the target asks again under a new parameter version and shows only the current answer.
ResourceDef
A file the application ships with its build, declared in the [resources] table of Bern.toml. Engines resolve it by name at run time; each target decides where it lives in the product. Neither the contents nor a build machine path are part of the IR.
SessionDef
Typed drafts owned by a UI session, one instance per hosting window.
SessionFieldDef
SizeCoverage
SourceLocation
Srgb
Template
Theme
WindowCatalog
Static window kinds declared by the root WindowSet. The first version supports single-instance windows only.
WindowDef

Enums§

Action
BinaryOp
Binding
Where a binding reads from.
ComponentArg
Coverage
Entries found for a feature in one size, by control target.
ExprKind
FeatureResult
The outcome for one feature in one size on one platform.
LayoutSize
A layout size of Adaptive.
MediaOp
A standard media command on an application player.
Node
ParamKind
Presentation
Prop
SessionOp
SvgPicture
How an SVG document shows as a picture of it (bern_svg::picture).
Text
ThemeMode
WindowChrome
WindowInitial
WindowOp
WindowRole

Constants§

IR_VERSION
Version of the IR layout. Targets declare the range they consume.
LIBRARY_DESCRIPTOR_VERSION
Version of the ComponentLibrary layout.

Functions§

holds_lowered_list
Whether nodes, the children of a column, hold a list lowered by lower_lists, directly or in their conditions.
label_key
Resource key of an enum variant label.
lazy_grid_items
The ForEach of a grid that, standing in a vertical scroll view, builds only the rows near what is in sight: a grid whose one child is a keyed ForEach, not laid out as masonry. Every target builds such a grid lazily; anywhere else it builds all its rows.
leads_row
Whether node, followed in a row by next, is the words that lead the row: a text, or a column standing at its leading edge, before a spacer. It takes the spacer’s room itself, so the controls after it keep their width and the words wrap in what is left, as a list row’s label does.
lower_lists
A list in a vertical scroll view builds only the rows near what is in sight: a keyed ForEach among the children of a Column there (through conditions) becomes a one-column grid of its rows, which every target builds lazily (see lazy_grid_items). The grid keeps the column’s look: align says how the rows stand across it, row_gap is the column’s gap (absent when the column has none, for the target’s own), it staggers as the column does, and with no rows it takes no place. A component counts as in a scroll view when every place that shows it is. Columns that reflow keep building all their rows, since their rows slide among each other.
lowered_list_align
The align a list lowered by lower_lists keeps: how its rows stand across it, as in the column it came from.
text_key
Resource key of a text declared on an element property.