Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.
Text dump + assertions over the rendered UI structure.
A [UiTree] is a plain owned description of what is on screen: ids, names,
kinds, logical rects, text labels, theme. Build it by hand while you build
the scene ([UiNode]), from keyed scene nodes ([UiTree::from_scene]), or
from an acknowledged aster_ui::semantics snapshot
([UiTree::from_semantics]). The scene itself does not store labels, ids or
kinds, so the tree is authored metadata, never inferred from pixels.
Structs
structaster_blueprint::uitree::UiNode
pub struct UiNode { /* see fields */ }Public fields
| field | type | |
|---|---|---|
id | String | Stable id (what tests address); unique within the tree by convention. |
name | String | Human name (its label). |
kind | String | Free-form kind: "Button", "Card", "Text", "Chart", ... |
rect | Rect | |
label | Option<String> | Visible text, if the node shows any. |
theme | Option<String> | Theme/variant this node was rendered with, if it differs from the tree's. |
hidden | bool | |
model_key | Option<aster_ui::ModelKey> | |
flags | Vec<String> | Interaction state words ("hovered", "pressed", "focused", "disabled", "focusable"); set by [crate::interact::Driver], empty otherwise. |
children | Vec<UiNode> | |
a11y | Option<Box<ui::a11y::NodeA11y>> | Accessibility facts recorded when the tree was built (see ui::a11y). |
Methods
fn new(id: impl Into<String>, kind: impl Into<String>, rect: Rect) -> Selffn flag(self, flag: impl Into<String>) -> Selffn has_flag(&self, flag: &str) -> boolfn name(self, name: impl Into<String>) -> Selffn label(self, label: impl Into<String>) -> Selffn theme(self, theme: impl Into<String>) -> Selffn hidden(self, hidden: bool) -> Selffn key(self, key: ModelKey) -> Selffn child(self, child: UiNode) -> Selffn center(&self) -> [f64; 2]
Trait implementations: Clone, Debug, PartialEq, StructuralPartialEq
structaster_blueprint::uitree::UiTree
pub struct UiTree { /* see fields */ }Public fields
| field | type | |
|---|---|---|
theme | Option<String> | |
viewport | Option<Rect> | Logical viewport; assert_visible requires intersection with it. |
roots | Vec<UiNode> |
Methods
fn new() -> Selffn theme(self, theme: impl Into<String>) -> Selffn viewport(self, width: f64, height: f64) -> Selffn node(self, node: UiNode) -> Selffn from_scene(scene: &Scene, entries: &[(ModelKey, &str, &str, Option<&str>)]) -> Result<Self, String>— Annotate keyed scene nodes:(model key, id, kind, label). Rects are the nodes' scene bounds, untransformed. Nesting follows the scene's parent chain, restricted to annotated nodes. Keys not in the scene are an error.fn from_semantics(snapshot: Snapshot<'_>) -> Self— Reuse an acknowledgedaster_ui::semanticssnapshot: role -> kind, name -> name and label, hidden state and bounds are carried over.fn iter(&self) -> impl Iterator<Item = &UiNode>fn find_id(&self, id: &str) -> Option<&UiNode>fn find_label(&self, text: &str) -> Option<&UiNode>— First node whose label (or, failing that, name) equalstext.fn find_kind<'a>(&self, kind: &'a str) -> impl Iterator<Item = &'a UiNode>fn center_of(&self, id: &str) -> Option<[f64; 2]>— Logical center of a node (for [crate::headless::Headless::hit]).fn dump(&self) -> String— Deterministic text dump, one node per line.fn assert_visible(&self, text: &str) -> &UiNode— Panics (with the full dump) unless a non-hidden, non-empty node labelledtextintersects the viewport. Returns it.fn assert_not_visible(&self, text: &str)fn assert_id(&self, id: &str) -> &UiNodefn assert_rect(&self, id: &str, expected: Rect, tol: f64)— Rect ofidequalsexpectedwithintollogical px on every edge.fn assert_label(&self, id: &str, expected: &str)fn assert_inside(&self, inner: &str, outer: &str, tol: f64)—inner's rect lies insideouter's (withintol).fn assert_flag(&self, id: &str, flag: &str)—idcarries interaction flagflag(e.g. "hovered").fn assert_no_flag(&self, id: &str, flag: &str)fn set_flags(&mut self, id: &str, flags: Vec<String>)— Replace the flags of nodeid(no-op when absent).fn assert_no_overlap(&self, a: &str, b: &str)fn semantics(&self) -> SemanticTree— Map this tree ontoaster_ui::semantics: roles, names, values, states (selected, disabled, focused, checked, expanded, invalid, required) and actions. Password-like (.sensitive()) contents are left out.fn audit_overflow(&self) -> Vec<OverflowIssue>— Find the containers whose children do not fit: a width set with.w(..)below a child'smin_w(aselectface is 180 px unlessselect_wsays less), atext()that never wraps in a narrow column, a row of rigid children wider than its parent. Layout never shrinks a child below its minimum, so this is clamped silently; here it is listed. Scroll containers are skipped (their content is reachable by scrolling) and so are overlays and layers; shapes drawn on purpose past a container (a shadow, a badge) are not children and are not listed. A container is listed when its children stick out by more than 1 px across or 4 px down.fn audit_a11y(&self) -> A11yReport— Check accessibility: unlabelled interactive elements, text below contrast, tab order that jumps backwards on screen, targets under 24x24 px and input fields whose boundary is under 3:1 ([FIELD_KINDS]). Hidden (clipped) and disabled elements are skipped. The text backdrops are measured here, not when the frame was built: a frame that is never audited never pays for them.fn audit_a11y_strict(&self) -> A11yReport— The strict tier, opt-in: [UiTree::audit_a11y] with the non-text contrast check ([UiTree::audit_non_text_contrast]) run on every control instead of the input fields only. A tonal button, a list row, a tab or a card marked by a 6 to 10 % fill alone is reported asLowComponentContrastuntil it has a boundary:.border(Col::Edge)(the theme's border moved toward the text colour until it is 3:1), or a fill that stands out. Use it when the design aims past WCAG 1.4.11's "the label identifies the component" allowance (ASTER_A11Y_STRICT=1makestests/a11y_gate.rsuse it).fn audit_non_text_contrast(&self) -> A11yReport— The non-text contrast check (WCAG 1.4.11, opt-in: [UiTree::audit_a11y] does not run it). Every enabled, visible interactive element with a fill or a border must show a boundary of at least [MIN_COMPONENT_CONTRAST]:1 against what is painted behind it: the border or the fill (composited over the backdrop) passing is enough, and a gradient is judged at its worse end. Elements with neither (a text link) are the text check's business, and a backdrop the audit cannot read (a picture, a blend mode) is skipped.fn text_contrasts(&self) -> Vec<(String, TextInfo)>— The measured contrast of every text in the tree, in tree order: the text's ink, the background it was measured against and the ratio. A rich text reports its worst run (the one that misses its threshold by the most;TextInfo::runsays which run it is). The backdrops are measured when this is called (the builder only records the paints), so a frame that is never asked pays nothing.
Trait implementations: Clone, Debug, Default, PartialEq, StructuralPartialEq
Type aliases
typeaster_blueprint::uitree::Rect
pub type Rect = [f64; 4];Logical-pixel rectangle [x, y, width, height].