pub struct SubcomposeMeasureScopeImpl<'a> { /* private fields */ }Expand description
Concrete implementation of SubcomposeMeasureScope.
Implementations§
Source§impl<'a> SubcomposeMeasureScopeImpl<'a>
impl<'a> SubcomposeMeasureScopeImpl<'a>
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.
Trait Implementations§
Source§impl MeasureScope for SubcomposeMeasureScopeImpl<'_>
impl MeasureScope for SubcomposeMeasureScopeImpl<'_>
Source§impl<'a> SubcomposeLayoutScope for SubcomposeMeasureScopeImpl<'a>
impl<'a> SubcomposeLayoutScope for SubcomposeMeasureScopeImpl<'a>
fn constraints(&self) -> Constraints
fn layout<I>(&mut self, width: f32, height: f32, placements: I) -> MeasureResultwhere
I: IntoIterator<Item = Placement>,
Source§impl<'a> SubcomposeMeasureScope for SubcomposeMeasureScopeImpl<'a>
impl<'a> SubcomposeMeasureScope for SubcomposeMeasureScopeImpl<'a>
Source§fn subcompose<K, Content>(
&mut self,
slot_id: SlotId,
key: K,
content: Content,
) -> Vec<SubcomposeChild>
fn subcompose<K, Content>( &mut self, slot_id: SlotId, key: K, content: Content, ) -> Vec<SubcomposeChild>
content into the slot, or reuses the retained composition
when it is provably current. Read more