Skip to main content

TreeNode

Struct TreeNode 

Source
pub struct TreeNode {
Show 22 fields pub id: NodeId, pub view_id: ViewId, pub kind: ViewKind, pub modifier: Modifier, pub semantics: Option<Semantics>, pub children: SmallVec<[NodeId; 4]>, pub parent: Option<NodeId>, pub content_hash: u64, pub layout_hash: u64, pub measurement_hash: u64, pub paint_hash: u64, pub semantics_hash: u64, pub subtree_hash: u64, pub layout_subtree_hash: u64, pub measurement_subtree_hash: u64, pub paint_subtree_hash: u64, pub semantics_subtree_hash: u64, pub layout_cache: Option<LayoutCache>, pub generation: u64, pub user_key: Option<u64>, pub depth: u32, pub scope_key: Option<String>,
}
Expand description

A node in the persistent view tree.

Fields§

§id: NodeId

Internal slotmap key.

§view_id: ViewId

User-facing stable view ID (for hit testing, focus, etc.).

§kind: ViewKind

The kind of view this node represents.

§modifier: Modifier

Layout and styling modifiers.

§semantics: Option<Semantics>§children: SmallVec<[NodeId; 4]>

Child node IDs.

§parent: Option<NodeId>

Parent node ID (None for root).

§content_hash: u64

Legacy aggregate hash of this node’s immediate content.

§layout_hash: u64

Hash of values that can change layout.

§measurement_hash: u64

Hash of values that can change text or intrinsic measurement.

§paint_hash: u64

Hash of values that can change painting.

§semantics_hash: u64

Hash of accessibility semantics.

§subtree_hash: u64

Legacy aggregate hash including all descendants.

§layout_subtree_hash: u64§measurement_subtree_hash: u64§paint_subtree_hash: u64§semantics_subtree_hash: u64§layout_cache: Option<LayoutCache>

Cached layout result.

§generation: u64

Generation when this node was last updated.

§user_key: Option<u64>

Key provided by user for stable identity in dynamic lists.

§depth: u32

Depth in tree (root = 0).

§scope_key: Option<String>

If this node is a scope boundary (set by scope! macro), this holds the scope key (e.g., “title”, “color_buttons”). None for non-scope nodes.

Implementations§

Source§

impl TreeNode

Source

pub fn new( id: NodeId, view_id: ViewId, kind: ViewKind, modifier: Modifier, generation: u64, ) -> Self

Create a new tree node.

Source

pub fn has_valid_layout(&self) -> bool

Check if this node’s layout cache is still valid.

Source

pub fn invalidate_layout(&mut self)

Invalidate layout cache (called when content changes).

Source

pub fn cached_rect(&self) -> Option<Rect>

Get cached layout if available.

Source

pub fn set_layout(&mut self, rect: Rect)

Trait Implementations§

Source§

impl Clone for TreeNode

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for TreeNode

§

impl !Send for TreeNode

§

impl !Sync for TreeNode

§

impl !UnwindSafe for TreeNode

§

impl Forget for TreeNode

§

impl Freeze for TreeNode
where NonZero<u32>: Freeze, *const u8 is !null: Freeze, PhantomData<u8>: Freeze, &'static str: Freeze, *const ArcInner<[TextSpan]> is !null: Freeze, PhantomData<ArcInner<[TextSpan]>>: Freeze, *const ArcInner<str> is !null: Freeze, PhantomData<ArcInner<str>>: Freeze, PhantomData<f32>: Freeze, *const ArcInner<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>> is !null: Freeze, PhantomData<ArcInner<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>>>: Freeze, *const ArcInner<ShapePath> is !null: Freeze, PhantomData<ArcInner<ShapePath>>: Freeze, *const RcInner<dyn Fn(Vec2) -> Vec2> is !null: Freeze, PhantomData<RcInner<dyn Fn(Vec2) -> Vec2>>: Freeze, *const RcInner<dyn Fn(Vec2, ScrollSource) -> Vec2> is !null: Freeze, PhantomData<RcInner<dyn Fn(Vec2, ScrollSource) -> Vec2>>: Freeze, *const RcInner<dyn Fn(f32)> is !null: Freeze, PhantomData<RcInner<dyn Fn(f32)>>: Freeze, *const RcInner<dyn Fn() -> f32> is !null: Freeze, PhantomData<RcInner<dyn Fn() -> f32>>: Freeze, *const RcInner<dyn Fn()> is !null: Freeze, PhantomData<RcInner<dyn Fn()>>: Freeze, *const RcInner<dyn Fn(NestedScrollConnection)> is !null: Freeze, PhantomData<RcInner<dyn Fn(NestedScrollConnection)>>: Freeze, *const RcInner<dyn Fn() -> (f32, f32)> is !null: Freeze, PhantomData<RcInner<dyn Fn() -> (f32, f32)>>: Freeze, *const RcInner<dyn Fn(f32, f32)> is !null: Freeze, PhantomData<RcInner<dyn Fn(f32, f32)>>: Freeze, *const RcInner<dyn Fn(&mut Scene, Rect, ControlVisualState)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut Scene, Rect, ControlVisualState)>>: Freeze, *const RcInner<dyn Fn(Vec2, NestedScrollSource) -> Vec2> is !null: Freeze, PhantomData<RcInner<dyn Fn(Vec2, NestedScrollSource) -> Vec2>>: Freeze, *const RcInner<dyn Fn(Vec2, Vec2, NestedScrollSource) -> Vec2> is !null: Freeze, PhantomData<RcInner<dyn Fn(Vec2, Vec2, NestedScrollSource) -> Vec2>>: Freeze, *const RcInner<dyn Fn(PointerEvent)> is !null: Freeze, PhantomData<RcInner<dyn Fn(PointerEvent)>>: Freeze, *const RcInner<dyn Fn(Rect)> is !null: Freeze, PhantomData<RcInner<dyn Fn(Rect)>>: Freeze, *const RcInner<dyn Fn(Vec2)> is !null: Freeze, PhantomData<RcInner<dyn Fn(Vec2)>>: Freeze, *const RcInner<dyn Fn(KeyEvent) -> bool> is !null: Freeze, PhantomData<RcInner<dyn Fn(KeyEvent) -> bool>>: Freeze, *const RcInner<dyn Fn(ImeEvent) -> bool> is !null: Freeze, PhantomData<RcInner<dyn Fn(ImeEvent) -> bool>>: Freeze, *const RcInner<dyn Fn(LayoutConstraints) -> (Dp, Dp)> is !null: Freeze, PhantomData<RcInner<dyn Fn(LayoutConstraints) -> (Dp, Dp)>>: Freeze, *const RcInner<dyn Fn() -> GraphicsLayerScope> is !null: Freeze, PhantomData<RcInner<dyn Fn() -> GraphicsLayerScope>>: Freeze, *const RcInner<SharedElementInner> is !null: Freeze, PhantomData<RcInner<SharedElementInner>>: Freeze, PhantomData<ModifierNodeHandle>: Freeze, *const RcInner<dyn Fn(&mut Scene, Rect, f32)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut Scene, Rect, f32)>>: Freeze, *const ArcInner<dyn Any + Sync + Send> is !null: Freeze, PhantomData<ArcInner<dyn Any + Sync + Send>>: Freeze, *const RcInner<dyn Fn(DragStart) -> Option<Rc<dyn Any>>> is !null: Freeze, PhantomData<RcInner<dyn Fn(DragStart) -> Option<Rc<dyn Any>>>>: Freeze, *const RcInner<dyn Fn(DragEnd)> is !null: Freeze, PhantomData<RcInner<dyn Fn(DragEnd)>>: Freeze, *const RcInner<dyn Fn(DragOver)> is !null: Freeze, PhantomData<RcInner<dyn Fn(DragOver)>>: Freeze, *const RcInner<dyn Fn(DropEvent) -> bool> is !null: Freeze, PhantomData<RcInner<dyn Fn(DropEvent) -> bool>>: Freeze, *const RcInner<dyn Fn(&mut Scene, &DragPreviewCtx)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut Scene, &DragPreviewCtx)>>: Freeze, *const RcInner<dyn Fn(Action) -> bool> is !null: Freeze, PhantomData<RcInner<dyn Fn(Action) -> bool>>: Freeze, *const ArcInner<CustomCursorImage> is !null: Freeze, PhantomData<ArcInner<CustomCursorImage>>: Freeze, *const RcInner<RefCell<Option<u64>>> is !null: Freeze, PhantomData<RcInner<RefCell<Option<u64>>>>: Freeze, *const RcInner<dyn Fn(bool)> is !null: Freeze, PhantomData<RcInner<dyn Fn(bool)>>: Freeze, *const RcInner<RefCell<InteractionState>> is !null: Freeze, PhantomData<RcInner<RefCell<InteractionState>>>: Freeze, *const RcInner<dyn Fn(String)> is !null: Freeze, PhantomData<RcInner<dyn Fn(String)>>: Freeze, *const RcInner<Cell<bool>> is !null: Freeze, PhantomData<RcInner<Cell<bool>>>: Freeze, *const RcInner<dyn VisualTransformation> is !null: Freeze, PhantomData<RcInner<dyn VisualTransformation>>: Freeze, *const RcInner<dyn Fn(&TextLayoutResult)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&TextLayoutResult)>>: Freeze, *const RcInner<dyn Fn(&dyn KeyboardActionScope)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&dyn KeyboardActionScope)>>: Freeze, *const RcInner<RefCell<Option<TextRange>>> is !null: Freeze, PhantomData<RcInner<RefCell<Option<TextRange>>>>: Freeze, *const RcInner<RefCell<TextLayoutGeometry>> is !null: Freeze, PhantomData<RcInner<RefCell<TextLayoutGeometry>>>: Freeze, *const RcInner<dyn IndicationNodeFactory> is !null: Freeze, PhantomData<RcInner<dyn IndicationNodeFactory>>: Freeze, *const NodeId is !null: Freeze, PhantomData<NodeId>: Freeze,

§

impl Move for TreeNode

§

impl Unpin for TreeNode
where NonZero<u32>: Unpin, *const u8 is !null: Unpin, &'static str: Unpin, Arc<[TextSpan]>: Unpin, Arc<str>: Unpin, Arc<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>>: Unpin, Arc<ShapePath>: Unpin, Rc<dyn Fn(Vec2) -> Vec2>: Unpin, Rc<dyn Fn(Vec2, ScrollSource) -> Vec2>: Unpin, Rc<dyn Fn(f32)>: Unpin, Rc<dyn Fn() -> f32>: Unpin, Rc<dyn Fn()>: Unpin, Rc<dyn Fn(NestedScrollConnection)>: Unpin, Rc<dyn Fn() -> (f32, f32)>: Unpin, Rc<dyn Fn(f32, f32)>: Unpin, Rc<dyn Fn(&mut Scene, Rect, ControlVisualState)>: Unpin, Rc<dyn Fn(Vec2, NestedScrollSource) -> Vec2>: Unpin, Rc<dyn Fn(Vec2, Vec2, NestedScrollSource) -> Vec2>: Unpin, Rc<dyn Fn(PointerEvent)>: Unpin, Rc<dyn Fn(Rect)>: Unpin, Rc<dyn Fn(Vec2)>: Unpin, Rc<dyn Fn(KeyEvent) -> bool>: Unpin, Rc<dyn Fn(ImeEvent) -> bool>: Unpin, Rc<dyn Fn(LayoutConstraints) -> (Dp, Dp)>: Unpin, Rc<dyn Fn() -> GraphicsLayerScope>: Unpin, Rc<SharedElementInner>: Unpin, Rc<dyn ModifierNodeElement>: Unpin, Rc<dyn ModifierNode>: Unpin, Rc<Cell<bool>>: Unpin, Rc<dyn Fn(&mut Scene, Rect, f32)>: Unpin, Arc<dyn Any + Sync + Send>: Unpin, Rc<dyn Fn(DragStart) -> Option<Rc<dyn Any>>>: Unpin, Rc<dyn Fn(DragEnd)>: Unpin, Rc<dyn Fn(DragOver)>: Unpin, Rc<dyn Fn(DropEvent) -> bool>: Unpin, Rc<dyn Fn(&mut Scene, &DragPreviewCtx)>: Unpin, Rc<dyn Fn(Action) -> bool>: Unpin, Arc<CustomCursorImage>: Unpin, Rc<RefCell<Option<u64>>>: Unpin, Rc<dyn Fn(bool)>: Unpin, Rc<RefCell<InteractionState>>: Unpin, Rc<dyn Fn(String)>: Unpin, Rc<dyn VisualTransformation>: Unpin, Rc<dyn Fn(&TextLayoutResult)>: Unpin, Rc<dyn Fn(&dyn KeyboardActionScope)>: Unpin, Rc<RefCell<Option<TextRange>>>: Unpin, Rc<RefCell<TextLayoutGeometry>>: Unpin, Rc<dyn IndicationNodeFactory>: Unpin, *const NodeId is !null: Unpin, NodeId: Unpin,

§

impl UnsafeUnpin for TreeNode
where NonZeroU32Inner: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, &'static str: UnsafeUnpin, *const ArcInner<[TextSpan]> is !null: UnsafeUnpin, PhantomData<ArcInner<[TextSpan]>>: UnsafeUnpin, *const ArcInner<str> is !null: UnsafeUnpin, PhantomData<ArcInner<str>>: UnsafeUnpin, PhantomData<f32>: UnsafeUnpin, *const ArcInner<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Fn(&SubcomposeScope) -> Vec<(u64, View)>>>: UnsafeUnpin, *const ArcInner<ShapePath> is !null: UnsafeUnpin, PhantomData<ArcInner<ShapePath>>: UnsafeUnpin, *const RcInner<dyn Fn(Vec2) -> Vec2> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Vec2) -> Vec2>>: UnsafeUnpin, *const RcInner<dyn Fn(Vec2, ScrollSource) -> Vec2> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Vec2, ScrollSource) -> Vec2>>: UnsafeUnpin, *const RcInner<dyn Fn(f32)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(f32)>>: UnsafeUnpin, *const RcInner<dyn Fn() -> f32> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn() -> f32>>: UnsafeUnpin, *const RcInner<dyn Fn()> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn()>>: UnsafeUnpin, *const RcInner<dyn Fn(NestedScrollConnection)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(NestedScrollConnection)>>: UnsafeUnpin, *const RcInner<dyn Fn() -> (f32, f32)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn() -> (f32, f32)>>: UnsafeUnpin, *const RcInner<dyn Fn(f32, f32)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(f32, f32)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut Scene, Rect, ControlVisualState)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut Scene, Rect, ControlVisualState)>>: UnsafeUnpin, *const RcInner<dyn Fn(Vec2, NestedScrollSource) -> Vec2> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Vec2, NestedScrollSource) -> Vec2>>: UnsafeUnpin, *const RcInner<dyn Fn(Vec2, Vec2, NestedScrollSource) -> Vec2> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Vec2, Vec2, NestedScrollSource) -> Vec2>>: UnsafeUnpin, *const RcInner<dyn Fn(PointerEvent)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(PointerEvent)>>: UnsafeUnpin, *const RcInner<dyn Fn(Rect)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Rect)>>: UnsafeUnpin, *const RcInner<dyn Fn(Vec2)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Vec2)>>: UnsafeUnpin, *const RcInner<dyn Fn(KeyEvent) -> bool> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(KeyEvent) -> bool>>: UnsafeUnpin, *const RcInner<dyn Fn(ImeEvent) -> bool> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(ImeEvent) -> bool>>: UnsafeUnpin, *const RcInner<dyn Fn(LayoutConstraints) -> (Dp, Dp)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(LayoutConstraints) -> (Dp, Dp)>>: UnsafeUnpin, *const RcInner<dyn Fn() -> GraphicsLayerScope> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn() -> GraphicsLayerScope>>: UnsafeUnpin, *const RcInner<SharedElementInner> is !null: UnsafeUnpin, PhantomData<RcInner<SharedElementInner>>: UnsafeUnpin, PhantomData<ModifierNodeHandle>: UnsafeUnpin, *const RcInner<dyn Fn(&mut Scene, Rect, f32)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut Scene, Rect, f32)>>: UnsafeUnpin, *const ArcInner<dyn Any + Sync + Send> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Any + Sync + Send>>: UnsafeUnpin, *const RcInner<dyn Fn(DragStart) -> Option<Rc<dyn Any>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(DragStart) -> Option<Rc<dyn Any>>>>: UnsafeUnpin, *const RcInner<dyn Fn(DragEnd)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(DragEnd)>>: UnsafeUnpin, *const RcInner<dyn Fn(DragOver)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(DragOver)>>: UnsafeUnpin, *const RcInner<dyn Fn(DropEvent) -> bool> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(DropEvent) -> bool>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut Scene, &DragPreviewCtx)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut Scene, &DragPreviewCtx)>>: UnsafeUnpin, *const RcInner<dyn Fn(Action) -> bool> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Action) -> bool>>: UnsafeUnpin, *const ArcInner<CustomCursorImage> is !null: UnsafeUnpin, PhantomData<ArcInner<CustomCursorImage>>: UnsafeUnpin, *const RcInner<RefCell<Option<u64>>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<Option<u64>>>>: UnsafeUnpin, *const RcInner<dyn Fn(bool)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(bool)>>: UnsafeUnpin, *const RcInner<RefCell<InteractionState>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<InteractionState>>>: UnsafeUnpin, *const RcInner<dyn Fn(String)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(String)>>: UnsafeUnpin, *const RcInner<Cell<bool>> is !null: UnsafeUnpin, PhantomData<RcInner<Cell<bool>>>: UnsafeUnpin, *const RcInner<dyn VisualTransformation> is !null: UnsafeUnpin, PhantomData<RcInner<dyn VisualTransformation>>: UnsafeUnpin, *const RcInner<dyn Fn(&TextLayoutResult)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&TextLayoutResult)>>: UnsafeUnpin, *const RcInner<dyn Fn(&dyn KeyboardActionScope)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&dyn KeyboardActionScope)>>: UnsafeUnpin, *const RcInner<RefCell<Option<TextRange>>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<Option<TextRange>>>>: UnsafeUnpin, *const RcInner<RefCell<TextLayoutGeometry>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<TextLayoutGeometry>>>: UnsafeUnpin, *const RcInner<dyn IndicationNodeFactory> is !null: UnsafeUnpin, PhantomData<RcInner<dyn IndicationNodeFactory>>: UnsafeUnpin, *const NodeId is !null: UnsafeUnpin, PhantomData<NodeId>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.