pub struct LayoutCx<'a> { /* private fields */ }
Expand description
Holds current layout state for given position in the tree.
You’ll use this in the View::layout
implementation to call layout_node
on children and to access any font
Implementations§
source§impl<'a> LayoutCx<'a>
impl<'a> LayoutCx<'a>
pub fn app_state_mut(&mut self) -> &mut AppState
pub fn app_state(&self) -> &AppState
pub fn get_computed_style(&mut self, id: Id) -> &Style
pub fn set_style(&mut self, node: Node, style: Style)
pub fn new_node(&mut self) -> Node
sourcepub fn layout_node(
&mut self,
id: Id,
has_children: bool,
children: impl FnMut(&mut LayoutCx<'_>) -> Vec<Node>
) -> Node
pub fn layout_node( &mut self, id: Id, has_children: bool, children: impl FnMut(&mut LayoutCx<'_>) -> Vec<Node> ) -> Node
Responsible for invoking the recalculation of style and thus the layout and creating or updating the layout of child nodes within the closure.
You should ensure that all children are laid out within the closure and/or whatever other work you need to do to ensure that the layout for the returned nodes is correct.
sourcepub fn layout_view(&mut self, view: &mut dyn View) -> Node
pub fn layout_view(&mut self, view: &mut dyn View) -> Node
Internal method used by Floem to invoke the user-defined View::layout
method.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for LayoutCx<'a>
impl<'a> !Send for LayoutCx<'a>
impl<'a> !Sync for LayoutCx<'a>
impl<'a> Unpin for LayoutCx<'a>
impl<'a> !UnwindSafe for LayoutCx<'a>
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