pub struct LayoutChild {
pub element_id: ElementId,
}Expand description
Handle used by widgets to lay out one retained direct child.
§Examples
use ailloli_ui_core::ElementId;
use ailloli_ui_runtime::layout::LayoutChild;
let child = LayoutChild { element_id: ElementId(3) };
assert_eq!(child.element_id, ElementId(3));Fields§
§element_id: ElementIdRetained-tree identity delegated to LayoutEngine.
Implementations§
Source§impl LayoutChild
Provides the operations defined for LayoutChild.
impl LayoutChild
Provides the operations defined for LayoutChild.
Sourcepub fn layout<A: 'static>(
&mut self,
engine: &mut LayoutEngine<'_, A>,
ctx: &mut LayoutCtx<'_>,
constraints: Constraints,
) -> LayoutResult
pub fn layout<A: 'static>( &mut self, engine: &mut LayoutEngine<'_, A>, ctx: &mut LayoutCtx<'_>, constraints: Constraints, ) -> LayoutResult
Lays out this child with the supplied logical-pixel constraints.
A stale or unknown element_id produces LayoutResult::zero and no
diagnostic cache event. Other behavior, including widget panics, is
delegated to LayoutEngine::layout_element.
§Examples
use ailloli_ui_core::{Constraints, ElementId, Scale, Size};
use ailloli_ui_runtime::element::ElementTree;
use ailloli_ui_runtime::layout::{LayoutChild, LayoutCtx, LayoutEngine};
let mut tree = ElementTree::<()>::new();
let mut engine = LayoutEngine::new(&mut tree);
let mut ctx = LayoutCtx::new(Scale::new(1.0));
let mut child = LayoutChild { element_id: ElementId(99) };
assert_eq!(
child.layout(&mut engine, &mut ctx, Constraints::tight(10.0, 20.0)).size,
Size::default(),
);Auto Trait Implementations§
impl Freeze for LayoutChild
impl RefUnwindSafe for LayoutChild
impl Send for LayoutChild
impl Sync for LayoutChild
impl Unpin for LayoutChild
impl UnwindSafe for LayoutChild
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
Mutably borrows from an owned value. Read more