pub struct Tree {Show 41 fields
pub keys: Vec<Key>,
pub origins: Vec<OriginId>,
pub specs: Vec<NodeSpec>,
pub content: Vec<NodeContent>,
pub parent: Vec<u32>,
pub first_child: Vec<u32>,
pub last_child: Vec<u32>,
pub next_sibling: Vec<u32>,
pub size: Vec<Size>,
pub pos: Vec<Vec2>,
pub scroll_max: Vec<Vec2>,
pub line: Vec<u32>,
pub baseline: Vec<f32>,
pub any_float: bool,
pub any_calc_bound: bool,
pub any_node_float: bool,
pub any_wrap: bool,
pub any_baseline: bool,
pub any_table: bool,
pub any_gradient: bool,
pub any_backdrop_blur: bool,
pub any_text: bool,
pub any_line: bool,
pub grow_scratch: Vec<u8>,
pub any_clip: bool,
pub any_rounded_clip: bool,
pub any_opacity: bool,
pub any_modal: bool,
pub any_region: bool,
pub any_slide: bool,
pub any_layout: bool,
pub any_context_menu: bool,
pub any_scroll_handler: bool,
pub any_drop: bool,
pub any_exit: bool,
pub any_animate: bool,
pub indexed: Vec<(u32, u64)>,
pub row_counts: Vec<(u32, u64)>,
pub fills: Vec<(Key, u32, u32)>,
pub any_selectable: bool,
pub host_area: Rect,
/* private fields */
}Expand description
One frame’s nodes as parallel arrays in preorder; see the module docs.
Fields§
§keys: Vec<Key>§origins: Vec<OriginId>§specs: Vec<NodeSpec>§content: Vec<NodeContent>§parent: Vec<u32>§first_child: Vec<u32>§last_child: Vec<u32>§next_sibling: Vec<u32>§size: Vec<Size>§pos: Vec<Vec2>§scroll_max: Vec<Vec2>Max scroll offset per axis (zero for non-scroll nodes).
line: Vec<u32>Which wrap line of its parent a node sits on, from the main-axis pass. Zero everywhere but under a wrapping container, and the in-flow children of one line are always a contiguous sibling run, so a line is a range rather than a list.
baseline: Vec<f32>Each node’s first baseline below its top, logical px, where text
measured one (NaN elsewhere). Filled by the fit-height pass, and
only on a frame with a baseline row (any_baseline); empty
otherwise.
any_float: boolWhether any node declares float.
any_calc_bound: boolWhether any node declares a size expression as a clamp (a
negative max_w, a Min::calc): layout resolves
them only then.
any_node_float: boolWhether any float is anchored to a node by key
(FloatAnchor::Node): the sixth layout pass runs only then.
any_wrap: boolWhether any node declares wrap_children.
any_baseline: boolWhether any node lines its children up by their baselines
(cross_align: Baseline): the layout measures baselines only then.
any_table: boolWhether any node is a table (LayoutSpec::table): the column
alignment in the layout passes runs only on a frame that has one.
any_gradient: boolWhether any node declares a gradient: emission looks for one
only on a frame that has one.
any_backdrop_blur: boolWhether any node declares a backdrop_blur (backlog F129):
emission looks for one only on a frame that has one.
any_text: boolWhether any node is text (a Text or Edit content).
any_line: boolWhether any node is a role="line" row — what a pointer payload
inside a key sink is resolved against, so a frame
without a custom editor never walks a sink’s subtree for one.
grow_scratch: Vec<u8>Scratch for the layout pass’s freeze loop (distribute_run): one
byte per in-flow child of the run being resolved, in child order.
Sized per run and never cleared, so the allocation is made once
and reused by every run of every frame.
any_clip: boolWhether any node clips (clip, or an overflow that scrolls).
any_rounded_clip: boolWhether any node clips and has a radius, so the clip its
descendants inherit is rounded. Separate from any_clip: the
per-corner bookkeeping is skipped for the ordinary square clip.
any_opacity: boolWhether any node fades (opacity below one).
any_modal: boolWhether any node declares modal.
any_region: boolWhether any node declares focus_region.
any_slide: boolWhether any node eases its position (slide, or an enter with
an offset) under a transition.
any_layout: boolWhether any node declares on_layout, so the rect report can skip
the walk.
Whether any node declares on_context_menu, so a hit region’s
walk for the menu it inherits is skipped wholesale on
a frame that offers none.
any_scroll_handler: boolSome node declared on_scroll; emission reads the row per node
only then.
any_drop: boolSome node declared on_drop: a hit region’s walk for
the zone it inherits is skipped wholesale on a frame with none.
any_exit: boolWhether any node declares a workable exit (one under a
transition). Gates the tree swap and the key diff.
any_animate: boolWhether any node asked for the next frame (animate): one node
asking is the whole window asking.
indexed: Vec<(u32, u64)>The data index of every node opened with one (open_indexed), by
node. A side list rather than a column, because it is a virtual
list’s rows and nothing else: a frame that builds none is one empty
Vec.
What it is for: a selection endpoint in a row that is not built can still be ordered against the rows that are, because a row’s index says where it sits in the data even when nothing on screen says where it sits in the frame.
row_counts: Vec<(u32, u64)>How many indexed rows a node’s virtual list has, built or not
(rowCount), by node. A side list for the reason indexed is one.
What it is for: Select All inside a selectable virtual list is
the data, rows 0..count, not the rows the frame happened to
build — and the count is the one thing about the data the core
cannot see.
fills: Vec<(Key, u32, u32)>The node range every slot fill opened, by the slot’s key: (slot, first, end) over node indices, innermost fill first (a fill
records itself after the fills inside it). A side list for the
reason indexed is one — a frame with no extension is one empty
Vec — and what stamps UiEvent::slot, so a host that fills many
slots from one extension can route an event by the slot it came
from without stamping every payload.
any_selectable: boolWhether any node declares selectable. False on every
frame of an app that never asks for one, which is what keeps the
scope walk and the off-screen places of tier 2 off those frames
entirely.
host_area: RectThe box a FloatConfig::viewport() float of the host’s resolves
against, in window coordinates: the whole window, or what the
devtools’ dock leaves of it. A zero rect means
the window. The devtools’ own nodes always use the window.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn opens_layer(&self, i: usize) -> bool
pub fn opens_layer(&self, i: usize) -> bool
Whether node i opens a float layer of its own (ADR 0023): a float
a view declared, or a stroke anchored to the viewport. A line,
polygon or path in its parent’s box space does not — the core
made its float so it takes no room, and it paints where a child
would (NodeContent::drawn_in_parent). Reads the float’s
anchor through FloatConfig::clipped_by_parent, which the core
sets for every such shape, so the one rule serves the clip and the
layer.
Sourcepub fn floats_in_parent(&self, i: usize) -> bool
pub fn floats_in_parent(&self, i: usize) -> bool
Whether node i is drawn in its parent’s layer, as a child is,
although it floats: Tree::opens_layer’s complement for a node
that declares float at all.
Sourcepub fn subtree_end(&self, i: usize) -> usize
pub fn subtree_end(&self, i: usize) -> usize
One past the last node of i’s subtree. Preorder storage makes a
subtree a contiguous index range ending at the next node that is a
sibling of i or of one of its ancestors.
Source§impl Tree
impl Tree
pub fn new() -> Tree
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn index_of(&self, key: Key) -> Option<usize>
pub fn index_of(&self, key: Key) -> Option<usize>
The index of the node key names in this frame, if it is here. A
linear scan: the one place to swap it for a map if a profile asks.
Sourcepub fn region_parent(&self, i: usize) -> u32
pub fn region_parent(&self, i: usize) -> u32
The parent an ancestor walk that means “where is this shown”
takes: the node’s parent, except for a float anchored to a node by
key, whose walk continues from the anchor (FloatAnchor::Node).
NIL past the root, and for an anchor the frame does not have.
Sourcepub fn slot_of(&self, i: usize) -> Option<Key>
pub fn slot_of(&self, i: usize) -> Option<Key>
The innermost slot fill node i was opened inside, if any.
Sourcepub fn note(&mut self, spec: &NodeSpec, content: &NodeContent)
pub fn note(&mut self, spec: &NodeSpec, content: &NodeContent)
Notes what a spec asks of the frame, so a pass whose work exists
for one feature can skip it when no node declared that feature.
Called by push for every node, and by the root paths that
replace a spec in place — the one door, so a leaf cannot forget a
flag a box would have set (an image once set two of these and
painted opaque when it was the frame’s only fade).
Each boxed group is tested once, not once per flag it can set: a node declaring no events and no animation is done after two null checks (C15).
pub fn push( &mut self, parent: u32, key: Key, origin: OriginId, spec: NodeSpec, content: NodeContent, ) -> u32
pub fn children(&self, i: u32) -> ChildIter<'_> ⓘ
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.