pub struct CardLayout<'a> { /* private fields */ }Expand description
Immutable fixed-storage measured card. Rebuild on copy/bounds changes; no cache, allocation, input consumption or external mutation occurs in layout.
Implementations§
Source§impl<'a> CardLayout<'a>
impl<'a> CardLayout<'a>
Sourcepub fn new(
bounds: Rect,
source: CardContent<'a>,
) -> Result<CardLayout<'a>, UiError>
pub fn new( bounds: Rect, source: CardContent<'a>, ) -> Result<CardLayout<'a>, UiError>
Validate/measure before insertion. Capacity means a section/action/byte/
total-stat-row bound was exceeded. DuplicateId means colliding IDs.
InvalidLayout includes a missing primary, blank title/action, multiline
action, impossible bounds or unrepresentable geometry. All actions and the
full title must fit at fixed sizes; insufficient space never inserts a
partial card. Unknown action queries return None. Existing UI budgets
are checked atomically by submission, not reserved by this pure layout.
Sourcepub fn title_rect(&self) -> Rect
pub fn title_rect(&self) -> Rect
Full fixed-size title rectangle.
Sourcepub fn content_bounds(&self) -> Rect
pub fn content_bounds(&self) -> Rect
Viewport for sections; feed its height to task274 ScrollState.
Sourcepub fn content_extent(&self) -> f32
pub fn content_extent(&self) -> f32
Full content-space height; feed to ScrollState::set_extents on reflow.
Sourcepub fn section_rect(&self, index: usize) -> Option<Rect>
pub fn section_rect(&self, index: usize) -> Option<Rect>
Unscrolled section rectangle, relative to the content origin.
Sourcepub fn action_rect(&self, id: u64) -> Option<Rect>
pub fn action_rect(&self, id: u64) -> Option<Rect>
Exactly the rectangle passed to the painted button and its hit registry.
Sourcepub fn submit(
&self,
group: &mut UiComposition<'_>,
scroll: Option<&ScrollState>,
) -> Result<CardReport, UiError>
pub fn submit( &self, group: &mut UiComposition<'_>, scroll: Option<&ScrollState>, ) -> Result<CardReport, UiError>
Atomically submit modal, panel, full title, content/notice and every action. All interaction, clip and inspection changes roll back through task281. Scroll must match both extents exactly and have positive viewport height; mismatch fails before insertion. Scroll is borrowed immutably: updating/ resetting it is caller-owned and lies outside the composition transaction. Existing ancestor clips apply unchanged, including to action hits; callers must keep the action area inside their visible safe region.