Struct LayoutResult

Source
pub struct LayoutResult {
    pub size: Size,
    pub children: Vec<ChildLayout>,
    pub paint_bounds: Rect,
    pub visual_bounds: Rect,
    pub overlay_hit_bounds: Vec<Rect>,
    pub clip: Option<ClipShape>,
    pub is_window_root_clip: bool,
    pub artifact: Option<LayoutArtifact>,
}
Expand description

Layout output for one element: geometry, child placement, clipping, and an artifact.

Rectangles use element-local logical pixels unless a field states otherwise. children is positional: entry n describes retained child n. An empty vector means that no direct child was laid out. No constructor validates finite or non-negative geometry.

§Examples

use ailloli_ui_core::{Rect, Size};
use ailloli_ui_runtime::layout::LayoutResult;

let mut result = LayoutResult::empty();
result.size = Size::new(80.0, 24.0);
result.paint_bounds = Rect::new(0.0, 0.0, 80.0, 24.0);
assert_eq!(result.children.len(), 0);

Fields§

§size: Size

Element size in logical pixels.

§children: Vec<ChildLayout>

Direct-child geometry, in the same order as the retained children.

§paint_bounds: Rect

Element-local region that may receive draw commands.

§visual_bounds: Rect

Element-local region containing paint plus visual effects such as shadows.

§overlay_hit_bounds: Vec<Rect>

Extra local hit-test regions for top-level overlays owned by this widget.

These rects do not affect layout, paint bounds, visual bounds, or parent clipping. The input router translates them to absolute coordinates and checks them before normal tree hit-testing.

§clip: Option<ClipShape>

Optional element-local clip; None means this result introduces no clip.

§is_window_root_clip: bool

Window root clip (Window::radius + clip_children on the surface wrapper).

§artifact: Option<LayoutArtifact>

Optional reusable layout data; None means paint must not expect an artifact.

Implementations§

Source§

impl LayoutResult

Provides the operations defined for LayoutResult.

Source

pub fn empty() -> Self

Returns a zero-sized result with no children, clips, overlays, or artifact.

Both bounds are (0, 0, 0, 0) and is_window_root_clip is false.

§Examples
use ailloli_ui_core::Size;
use ailloli_ui_runtime::layout::LayoutResult;

let result = LayoutResult::empty();
assert_eq!(result.size, Size::default());
assert!(result.children.is_empty() && result.artifact.is_none());
Source

pub fn zero() -> Self

Alias for Self::empty.

§Examples
use ailloli_ui_runtime::layout::LayoutResult;

let result = LayoutResult::zero();
assert_eq!(result.paint_bounds.w, 0.0);

Trait Implementations§

Source§

impl Clone for LayoutResult

Source§

fn clone(&self) -> LayoutResult

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LayoutResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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<A> IntoClickAction<A> for A
where A: Clone + 'static,

Source§

fn into_click_action(self) -> ClickAction<A>

Implements the into_click_action helper used by this module.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Props for T
where T: Clone + 'static,