Expand description
The mount contract (ADR 0013): a component says what it needs
(Mountable), a host says what it offers (HostOffer), and
check matches the two with eleven named rules (Rule).
A pair either fits, fits under named conditions, or does not fit,
with a reason of one kind: by design (a rule kept on purpose, with
what to do instead), an egui-pop limit (work not done yet), or an
upstream limit (egui, eframe or another dependency). Each condition
and reason is a Code whose text lives once, in CODES: the
generated docs/hosts.md, the reported refusals and the debug
bridge all show that text.
use egui_pop_model::mount::{self, Fit, HostOffer, HostSize, Mountable};
let viewport = Mountable::new("viewport", "Image viewport").fills();
let status_bar = HostOffer::new("status-bar", "S", "Status bar").size(HostSize::Row);
match mount::check(&viewport, &status_bar) {
Fit::No { refusal, .. } => assert_eq!(refusal.code, "D1"),
other => panic!("{other:?}"),
}Modules§
- page
docs/hosts.md, written from the declarations: the hosts and their offers, the components and their needs, the matrix ofcheckverdicts, the rules, the conditions and the reasons, and the counts.cargo xtask hostswrites it; a test fails when the committed page differs from a fresh one.
Structs§
- Code
- A condition or a reason, written once.
- Condition
- A condition a fit is under.
- Host
Offer - What a host offers what is mounted in it.
- Mountable
- What a component needs from the place it is mounted in.
- Pointer
- What a component does with the pointer.
- Refusal
- Why a pair does not fit.
- Size
Need - The size a component needs, in points.
Enums§
- Claim
Key - A key a component may claim, and a host may own.
- Code
Kind - The kind of a
Code. - Dismiss
- What closes a transient host.
- Display
- The colours a component needs.
- Fit
- Whether a component fits a host.
- Focus
Policy - Who gets the keyboard in a host.
- Host
Display - The colours a host can show.
- Host
Size - The room a host gives.
- Instances
- How many of a component an application may show.
- Keep
- What a host keeps across showings and restarts.
- Keyboard
- How a component uses the keyboard.
- Lifetime
- Rule
- The matching rules, in the order they are checked.
- Window
- Which window a host is in.
- Workers
- Work done off the interface thread for a component.
Constants§
- CODES
- Every condition and reason.
- ROW_
HEIGHT - The height of a line host (a bar, the status bar), in points: a component needing more does not fit there.