pub struct SubcomposeLayoutNode { /* private fields */ }Expand description
Node responsible for orchestrating measure-time subcomposition.
Implementations§
Source§impl SubcomposeLayoutNode
impl SubcomposeLayoutNode
Sourcepub fn new(
modifier: Modifier,
measure_policy: Rc<dyn for<'scope> Fn(&mut SubcomposeMeasureScopeImpl<'scope>, Constraints) -> MeasureResult>,
) -> Self
pub fn new( modifier: Modifier, measure_policy: Rc<dyn for<'scope> Fn(&mut SubcomposeMeasureScopeImpl<'scope>, Constraints) -> MeasureResult>, ) -> Self
Creates a node with modifier whose children measure_policy subcomposes and measures.
Sourcepub fn with_content_type_policy(
modifier: Modifier,
measure_policy: Rc<dyn for<'scope> Fn(&mut SubcomposeMeasureScopeImpl<'scope>, Constraints) -> MeasureResult>,
) -> Self
pub fn with_content_type_policy( modifier: Modifier, measure_policy: Rc<dyn for<'scope> Fn(&mut SubcomposeMeasureScopeImpl<'scope>, Constraints) -> MeasureResult>, ) -> Self
Creates a SubcomposeLayoutNode with ContentTypeReusePolicy.
Use this for lazy lists to enable content-type-aware slot reuse. Slots with matching content types can reuse each other’s nodes, improving efficiency when scrolling through items with different types.
Sourcepub fn handle(&self) -> SubcomposeLayoutNodeHandle
pub fn handle(&self) -> SubcomposeLayoutNodeHandle
Returns a cloneable handle that shares this node’s state.
Sourcepub fn set_measure_policy(
&mut self,
policy: Rc<dyn for<'scope> Fn(&mut SubcomposeMeasureScopeImpl<'scope>, Constraints) -> MeasureResult>,
)
pub fn set_measure_policy( &mut self, policy: Rc<dyn for<'scope> Fn(&mut SubcomposeMeasureScopeImpl<'scope>, Constraints) -> MeasureResult>, )
Replaces the measure policy and invalidates the subcomposition. Does nothing if policy is
the same Rc as the current one.
Sourcepub fn set_captured_context(&mut self, context: CapturedCompositionContext)
pub fn set_captured_context(&mut self, context: CapturedCompositionContext)
Records the source composition context for measure-time subcomposition.
A context under a changed static composition local makes every slot
compose again, running every body it holds, as Compose forces a
SubcomposeLayout’s children.
Sourcepub fn set_density(&mut self, density: Density)
pub fn set_density(&mut self, density: Density)
Records the grid the composition provided, re-measuring if it moved.
Mirrors LayoutNode::set_density:
SubcomposeLayout captures this at the same composition site that
captures the subcomposition context, so the two cannot disagree.
Sourcepub fn set_layout_direction(&mut self, direction: LayoutDirection)
pub fn set_layout_direction(&mut self, direction: LayoutDirection)
Updates relative modifier placement for this node’s composition scope.
Sourcepub fn set_modifier(&mut self, modifier: Modifier)
pub fn set_modifier(&mut self, modifier: Modifier)
Replaces the modifier chain and invalidates the layout, draw, pointer input and semantics work that the changed modifier nodes affect.
Sourcepub fn set_debug_modifiers(&mut self, enabled: bool)
pub fn set_debug_modifiers(&mut self, enabled: bool)
Turns debug logging of the modifier chain on or off.
Sourcepub fn resolved_modifiers(&self) -> ResolvedModifiers
pub fn resolved_modifiers(&self) -> ResolvedModifiers
Returns the padding, layout properties and offset that the modifier chain resolved to.
Sourcepub fn layout_state(&self) -> LayoutState
pub fn layout_state(&self) -> LayoutState
Returns a clone of the current layout state.
Sourcepub fn set_position(&self, position: Point)
pub fn set_position(&self, position: Point)
Updates the position of this node. Called during placement.
LayoutState::place self-reports actual moves to the scene phase.
Sourcepub fn set_measured_size(&self, size: Size)
pub fn set_measured_size(&self, size: Size)
Updates the measured size of this node. Called during measurement.
LayoutState::set_size self-reports actual changes to the scene
phase.
Sourcepub fn clear_placed(&self)
pub fn clear_placed(&self)
Clears the is_placed flag. Called at the start of a layout pass.
Sourcepub fn semantics_configuration(&self) -> Option<SemanticsConfiguration>
pub fn semantics_configuration(&self) -> Option<SemanticsConfiguration>
Semantics reported by this node’s live modifier chain.
Sourcepub fn semantics_reach(&self) -> SemanticsReach
pub fn semantics_reach(&self) -> SemanticsReach
Whether this node’s modifiers make it modal or hidden.
Sourcepub fn modifier_slices_snapshot(&self) -> Rc<ModifierNodeSlices>
pub fn modifier_slices_snapshot(&self) -> Rc<ModifierNodeSlices>
Returns the modifier slices snapshot for rendering.
Sourcepub fn state(&self) -> Ref<'_, SubcomposeState>
pub fn state(&self) -> Ref<'_, SubcomposeState>
Borrows the subcomposition state that tracks the slots composed for this node.
Sourcepub fn state_mut(&self) -> RefMut<'_, SubcomposeState>
pub fn state_mut(&self) -> RefMut<'_, SubcomposeState>
Mutably borrows the subcomposition state that tracks the slots composed for this node.
Sourcepub fn invalidate_subcomposition(&self)
pub fn invalidate_subcomposition(&self)
Invalidates the recompose scopes of all slots and schedules a measure, so the measure policy subcomposes again.
Sourcepub fn request_measure_recompose(&self)
pub fn request_measure_recompose(&self)
Schedules a measure for this node and its ancestors without invalidating the recompose scopes of its slots.
Sourcepub fn with_active_children<R>(&self, f: impl FnOnce(&[NodeId]) -> R) -> R
pub fn with_active_children<R>(&self, f: impl FnOnce(&[NodeId]) -> R) -> R
Calls f with the children this node placed in its last layout, in
placement order, without copying them.
Changes through a node handle during f become visible to the next
read; this read keeps its original children.
Sourcepub fn mark_needs_measure(&self)
pub fn mark_needs_measure(&self)
Mark this node as needing measure. Also marks it as needing layout.
Sourcepub fn mark_needs_layout_flag(&self)
pub fn mark_needs_layout_flag(&self)
Mark this node as needing layout (but not necessarily measure).
Sourcepub fn mark_needs_redraw(&self)
pub fn mark_needs_redraw(&self)
Mark this node as needing redraw without forcing measure/layout.
Sourcepub fn needs_measure(&self) -> bool
pub fn needs_measure(&self) -> bool
Check if this node needs measure.
Sourcepub fn mark_needs_semantics(&self)
pub fn mark_needs_semantics(&self)
Mark this node as needing semantics recomputation.
Sourcepub fn needs_redraw(&self) -> bool
pub fn needs_redraw(&self) -> bool
Returns true when this node requested a redraw since the last render pass.
Sourcepub fn clear_needs_redraw(&self)
pub fn clear_needs_redraw(&self)
Clears the pending redraw flag once the node has been drawn.
Sourcepub fn mark_needs_pointer_pass(&self)
pub fn mark_needs_pointer_pass(&self)
Marks this node as needing a fresh pointer-input pass.
Sourcepub fn needs_pointer_pass(&self) -> bool
pub fn needs_pointer_pass(&self) -> bool
Returns true when pointer-input state needs to be recomputed.
Sourcepub fn clear_needs_pointer_pass(&self)
pub fn clear_needs_pointer_pass(&self)
Clears the pointer-input dirty flag after hosts service it.
Sourcepub fn mark_needs_focus_sync(&self)
pub fn mark_needs_focus_sync(&self)
Marks this node as needing a focus synchronization.
Sourcepub fn needs_focus_sync(&self) -> bool
pub fn needs_focus_sync(&self) -> bool
Returns true when focus state needs to be synchronized.
Sourcepub fn clear_needs_focus_sync(&self)
pub fn clear_needs_focus_sync(&self)
Clears the focus dirty flag after the focus manager processes it.
Sourcepub fn modifier_capabilities(&self) -> NodeCapabilities
pub fn modifier_capabilities(&self) -> NodeCapabilities
Returns the modifier capabilities for this node.
Sourcepub fn has_layout_modifier_nodes(&self) -> bool
pub fn has_layout_modifier_nodes(&self) -> bool
Returns whether the modifier chain contains layout modifier nodes.
Sourcepub fn has_draw_modifier_nodes(&self) -> bool
pub fn has_draw_modifier_nodes(&self) -> bool
Returns whether the modifier chain contains draw modifier nodes.
Sourcepub fn has_pointer_input_modifier_nodes(&self) -> bool
pub fn has_pointer_input_modifier_nodes(&self) -> bool
Returns whether the modifier chain contains pointer input modifier nodes.
Sourcepub fn has_semantics_modifier_nodes(&self) -> bool
pub fn has_semantics_modifier_nodes(&self) -> bool
Returns whether the modifier chain contains semantics modifier nodes.
Sourcepub fn has_focus_modifier_nodes(&self) -> bool
pub fn has_focus_modifier_nodes(&self) -> bool
Returns whether the modifier chain contains focus modifier nodes.
Trait Implementations§
Source§impl Node for SubcomposeLayoutNode
impl Node for SubcomposeLayoutNode
Source§fn mark_descendant_needs_semantics(&self)
fn mark_descendant_needs_semantics(&self)
One flag serves both: the tree merges a subcompose node on every update, and a descendant’s change leaves its reach as it was.
Source§fn mount(&mut self)
fn mount(&mut self)
Source§fn insert_child(&mut self, child: NodeId) -> bool
fn insert_child(&mut self, child: NodeId) -> bool
child to this node’s child list, returning whether the list
actually changed. A node that already holds the child returns false:
callers record a structural change from this answer, and a structural
change re-lowers the whole subtree, so claiming one for a no-op costs a
full rebuild per call.Source§fn remove_child(&mut self, child: NodeId) -> bool
fn remove_child(&mut self, child: NodeId) -> bool
child from this node’s child list, returning whether the list
actually changed. Only this node can answer that: a caller inspecting
the child’s parent pointer gets it wrong when the child was reparented
while still listed here.Source§fn move_child(&mut self, from: usize, to: usize)
fn move_child(&mut self, from: usize, to: usize)
Source§fn update_children(&mut self, children: &[NodeId])
fn update_children(&mut self, children: &[NodeId])
children, in order.Source§fn collect_children_into(&self, out: &mut SmallVec<[NodeId; 8]>)
fn collect_children_into(&self, out: &mut SmallVec<[NodeId; 8]>)
Source§fn collect_owned_children_into(&self, out: &mut SmallVec<[NodeId; 8]>)
fn collect_owned_children_into(&self, out: &mut SmallVec<[NodeId; 8]>)
out. A node whose
collect_children_into leaves some children out overrides this to list them all. The
default calls collect_children_into.Source§fn owned_child_index(&self, child: NodeId) -> Option<usize>
fn owned_child_index(&self, child: NodeId) -> Option<usize>
Node::collect_owned_children_into.
Nodes with slice-backed child storage should override this to avoid
materializing the whole list for a single lookup. Read moreSource§fn set_node_id(&mut self, id: NodeId)
fn set_node_id(&mut self, id: NodeId)
Source§fn on_attached_to_parent(&mut self, parent: NodeId)
fn on_attached_to_parent(&mut self, parent: NodeId)
Source§fn on_removed_from_parent(&mut self)
fn on_removed_from_parent(&mut self)
Source§fn parent(&self) -> Option<NodeId>
fn parent(&self) -> Option<NodeId>
Source§fn mark_needs_layout(&self)
fn mark_needs_layout(&self)
Source§fn needs_layout(&self) -> bool
fn needs_layout(&self) -> bool
Source§fn mark_needs_measure(&self)
fn mark_needs_measure(&self)
Source§fn needs_measure(&self) -> bool
fn needs_measure(&self) -> bool
Source§fn mark_descendant_needs_layout(&self, measure: bool)
fn mark_descendant_needs_layout(&self, measure: bool)
measure is set: a layout pass has to visit this node to reach it,
while this node’s own measurement may still hold. A node that does not
track the difference marks itself dirty.Source§fn descendant_needs_layout(&self) -> bool
fn descendant_needs_layout(&self) -> bool
Source§fn descendant_needs_measure(&self) -> bool
fn descendant_needs_measure(&self) -> bool
Source§fn mark_needs_semantics(&self)
fn mark_needs_semantics(&self)
Source§fn needs_semantics(&self) -> bool
fn needs_semantics(&self) -> bool
Source§fn set_parent_for_bubbling(&mut self, parent: NodeId)
fn set_parent_for_bubbling(&mut self, parent: NodeId)
Source§fn layout_dirty(&self) -> bool
fn layout_dirty(&self) -> bool
Source§fn is_virtual(&self) -> bool
fn is_virtual(&self) -> bool
Source§fn recycle_key(&self) -> Option<TypeId>
fn recycle_key(&self) -> Option<TypeId>
Source§fn recycle_pool_limit(&self) -> Option<usize>
fn recycle_pool_limit(&self) -> Option<usize>
Source§fn prepare_for_recycle(&mut self)
fn prepare_for_recycle(&mut self)
Source§fn rehouse_for_recycle(&self) -> Option<Box<dyn Node>>
fn rehouse_for_recycle(&self) -> Option<Box<dyn Node>>
Source§fn rehouse_for_live_compaction(&mut self) -> Option<Box<dyn Node>>
fn rehouse_for_live_compaction(&mut self) -> Option<Box<dyn Node>>
Source§fn debug_heap_bytes(&self) -> usize
fn debug_heap_bytes(&self) -> usize
Auto Trait Implementations§
impl !Freeze for SubcomposeLayoutNode
impl !RefUnwindSafe for SubcomposeLayoutNode
impl !Send for SubcomposeLayoutNode
impl !Sync for SubcomposeLayoutNode
impl !UnwindSafe for SubcomposeLayoutNode
impl Unpin for SubcomposeLayoutNode
impl UnsafeUnpin for SubcomposeLayoutNode
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<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more