pub struct SubcomposeMeasureScopeImpl<'a> { /* private fields */ }Expand description
Concrete implementation of SubcomposeMeasureScope.
Implementations§
Source§impl<'a> SubcomposeMeasureScopeImpl<'a>
impl<'a> SubcomposeMeasureScopeImpl<'a>
pub fn new( composer: Composer, state: &'a mut SubcomposeState, constraints: Constraints, measurer: Box<dyn FnMut(NodeId, Constraints) -> Size + 'a>, error: Rc<RefCell<Option<NodeError>>>, parent_handle: SubcomposeLayoutNodeHandle, root_id: NodeId, ) -> Self
Source§impl<'a> SubcomposeMeasureScopeImpl<'a>
impl<'a> SubcomposeMeasureScopeImpl<'a>
Sourcepub fn subcompose_with_size<Content, F>(
&mut self,
slot_id: SlotId,
content: Content,
estimate_size: F,
) -> Vec<SubcomposeChild>
pub fn subcompose_with_size<Content, F>( &mut self, slot_id: SlotId, content: Content, estimate_size: F, ) -> Vec<SubcomposeChild>
Subcomposes content and assigns estimated sizes to children.
This is used by lazy layouts where true measurement happens later.
The estimate_size function provides size estimates based on index.
Sourcepub fn active_slots_count(&self) -> usize
pub fn active_slots_count(&self) -> usize
Returns the number of active slots in the subcompose state.
Used by lazy layouts to report statistics about slot usage.
Sourcepub fn reusable_slots_count(&self) -> usize
pub fn reusable_slots_count(&self) -> usize
Returns the number of reusable slots in the pool.
Used by lazy layouts to report statistics about cached slots.
Sourcepub fn register_content_type(&mut self, slot_id: SlotId, content_type: u64)
pub fn register_content_type(&mut self, slot_id: SlotId, content_type: u64)
Registers the content type for a slot.
Call this before subcompose() to enable content-type-aware slot reuse.
If the policy supports content types (like ContentTypeReusePolicy),
slots with matching content types can reuse each other’s nodes.
Sourcepub fn update_content_type(
&mut self,
slot_id: SlotId,
content_type: Option<u64>,
)
pub fn update_content_type( &mut self, slot_id: SlotId, content_type: Option<u64>, )
Updates the content type for a slot, handling Some→None transitions.
If content_type is Some(type), registers the type for the slot.
If content_type is None, removes any previously registered type.
This ensures stale types don’t drive incorrect reuse after transitions.
Sourcepub fn was_last_slot_reused(&self) -> Option<bool>
pub fn was_last_slot_reused(&self) -> Option<bool>
Returns whether the last subcomposed slot was reused.
Returns Some(true) if the slot already existed (was reused from pool or
was recomposed), Some(false) if it was newly created, or None if no
slot has been subcomposed yet this pass.
This is useful for tracking composition statistics in lazy layouts.