pub struct LayoutNode<T>where
T: 'static,{
pub style: Style,
pub unrounded_layout: Layout,
pub final_layout: Layout,
pub cache: Cache,
pub context: Option<T>,
}
Fields§
§style: Style
§unrounded_layout: Layout
§final_layout: Layout
§cache: Cache
§context: Option<T>
Implementations§
Source§impl<T> LayoutNode<T>where
T: 'static,
impl<T> LayoutNode<T>where
T: 'static,
Sourcepub fn new(style: Style) -> Self
pub fn new(style: Style) -> Self
Examples found in repository?
examples/basic.rs (line 21)
11fn container<P, C>(s: Scope<P>, style: Style, content: C)
12where
13 P: 'static,
14 C: Fn(Scope<Container>) + Clone + 'static,
15{
16 let scope = s.child::<Container>();
17 s.create_node(
18 scope,
19 content,
20 move || style.clone(),
21 |style, _| LayoutNode::new(style),
22 |n, style, _| {
23 if n.style != style {
24 n.style = style;
25 n.mark_dirty();
26 }
27 },
28 );
29}
30
31struct Leaf;
32
33#[track_caller]
34fn leaf<P>(s: Scope<P>, style: Style)
35where
36 P: 'static,
37{
38 let scope = s.child::<Leaf>();
39 s.create_node(
40 scope,
41 |_| {},
42 move || style.clone(),
43 |style, _| LayoutNode::new(style),
44 |n, style, _| {
45 if n.style != style {
46 n.style = style;
47 n.mark_dirty();
48 }
49 },
50 );
51}
More examples
examples/basic_any.rs (line 23)
13fn container<P, C>(s: Scope<P>, style: Style, content: C)
14where
15 P: 'static,
16 C: Fn(Scope<Container>) + Clone + 'static,
17{
18 let scope = s.child::<Container>();
19 s.create_node(
20 scope,
21 content,
22 move || style.clone(),
23 |style, _| LayoutNode::new(style),
24 |n, style, _| {
25 if n.style != style {
26 n.style = style;
27 n.mark_dirty();
28 }
29 },
30 );
31}
32
33struct Leaf;
34
35#[track_caller]
36fn leaf<P>(s: Scope<P>, style: Style)
37where
38 P: 'static,
39{
40 let scope = s.child::<Leaf>();
41 s.create_node(
42 scope,
43 |_| {},
44 move || style.clone(),
45 |style, _| LayoutNode::new(style),
46 |n, style, _| {
47 if n.style != style {
48 n.style = style;
49 n.mark_dirty();
50 }
51 },
52 );
53}
pub fn with_context(style: Style, context: T) -> Self
Sourcepub fn mark_dirty(&mut self)
pub fn mark_dirty(&mut self)
Examples found in repository?
examples/basic.rs (line 25)
11fn container<P, C>(s: Scope<P>, style: Style, content: C)
12where
13 P: 'static,
14 C: Fn(Scope<Container>) + Clone + 'static,
15{
16 let scope = s.child::<Container>();
17 s.create_node(
18 scope,
19 content,
20 move || style.clone(),
21 |style, _| LayoutNode::new(style),
22 |n, style, _| {
23 if n.style != style {
24 n.style = style;
25 n.mark_dirty();
26 }
27 },
28 );
29}
30
31struct Leaf;
32
33#[track_caller]
34fn leaf<P>(s: Scope<P>, style: Style)
35where
36 P: 'static,
37{
38 let scope = s.child::<Leaf>();
39 s.create_node(
40 scope,
41 |_| {},
42 move || style.clone(),
43 |style, _| LayoutNode::new(style),
44 |n, style, _| {
45 if n.style != style {
46 n.style = style;
47 n.mark_dirty();
48 }
49 },
50 );
51}
More examples
examples/basic_any.rs (line 27)
13fn container<P, C>(s: Scope<P>, style: Style, content: C)
14where
15 P: 'static,
16 C: Fn(Scope<Container>) + Clone + 'static,
17{
18 let scope = s.child::<Container>();
19 s.create_node(
20 scope,
21 content,
22 move || style.clone(),
23 |style, _| LayoutNode::new(style),
24 |n, style, _| {
25 if n.style != style {
26 n.style = style;
27 n.mark_dirty();
28 }
29 },
30 );
31}
32
33struct Leaf;
34
35#[track_caller]
36fn leaf<P>(s: Scope<P>, style: Style)
37where
38 P: 'static,
39{
40 let scope = s.child::<Leaf>();
41 s.create_node(
42 scope,
43 |_| {},
44 move || style.clone(),
45 |style, _| LayoutNode::new(style),
46 |n, style, _| {
47 if n.style != style {
48 n.style = style;
49 n.mark_dirty();
50 }
51 },
52 );
53}
Trait Implementations§
Source§impl<T> Clone for LayoutNode<T>where
T: 'static + Clone,
impl<T> Clone for LayoutNode<T>where
T: 'static + Clone,
Source§fn clone(&self) -> LayoutNode<T>
fn clone(&self) -> LayoutNode<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> ComposeNode for LayoutNode<T>where
T: 'static,
impl<T> ComposeNode for LayoutNode<T>where
T: 'static,
type Context = TaffyConfig
Source§impl<T> Debug for LayoutNode<T>where
T: 'static + Debug,
impl<T> Debug for LayoutNode<T>where
T: 'static + Debug,
Source§impl<T> TaffyNode for LayoutNode<T>where
T: 'static,
impl<T> TaffyNode for LayoutNode<T>where
T: 'static,
type NodeContext = T
Source§type CoreContainerStyle = Style
type CoreContainerStyle = Style
The style type representing the core container styles that all containers should have
Used when laying out the root node of a tree
Source§type BlockContainerStyle<'a> = &'a Style
where
Self: 'a
type BlockContainerStyle<'a> = &'a Style where Self: 'a
The style type representing the CSS Block container’s styles
Source§type BlockItemStyle<'a> = &'a Style
where
Self: 'a
type BlockItemStyle<'a> = &'a Style where Self: 'a
The style type representing each CSS Block item’s styles
Source§type FlexboxContainerStyle<'a> = &'a Style
where
Self: 'a
type FlexboxContainerStyle<'a> = &'a Style where Self: 'a
The style type representing the Flexbox container’s styles
Source§type FlexboxItemStyle<'a> = &'a Style
where
Self: 'a
type FlexboxItemStyle<'a> = &'a Style where Self: 'a
The style type representing each Flexbox item’s styles
Source§type GridContainerStyle<'a> = &'a Style
where
Self: 'a
type GridContainerStyle<'a> = &'a Style where Self: 'a
The style type representing the CSS Grid container’s styles
Source§type GridItemStyle<'a> = &'a Style
where
Self: 'a
type GridItemStyle<'a> = &'a Style where Self: 'a
The style type representing each CSS Grid item’s styles
fn get_node_context(&self) -> Option<&Self::NodeContext>
fn get_node_context_mut(&mut self) -> Option<&mut Self::NodeContext>
fn get_node_context_mut_with_core_style( &mut self, ) -> (Option<&mut Self::NodeContext>, &Self::CoreContainerStyle)
fn get_display(&self) -> Display
fn get_final_layout(&self) -> &Layout
fn set_final_layout(&mut self, layout: &Layout)
fn get_unrounded_layout(&self) -> &Layout
fn set_unrounded_layout(&mut self, layout: &Layout)
fn cache_get( &self, known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, run_mode: RunMode, ) -> Option<LayoutOutput>
fn cache_store( &mut self, known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, run_mode: RunMode, layout_output: LayoutOutput, )
fn cache_clear(&mut self)
fn get_core_container_style(&self) -> &Self::CoreContainerStyle
fn get_block_container_style(&self) -> Self::BlockContainerStyle<'_>
fn get_block_item_style(&self) -> Self::BlockItemStyle<'_>
fn get_flexbox_container_style(&self) -> Self::FlexboxContainerStyle<'_>
fn get_flexbox_item_style(&self) -> Self::FlexboxItemStyle<'_>
fn get_grid_container_style(&self) -> Self::GridContainerStyle<'_>
fn get_grid_item_style(&self) -> Self::GridItemStyle<'_>
Auto Trait Implementations§
impl<T> Freeze for LayoutNode<T>where
T: Freeze,
impl<T> RefUnwindSafe for LayoutNode<T>where
T: RefUnwindSafe,
impl<T> Send for LayoutNode<T>where
T: Send,
impl<T> Sync for LayoutNode<T>where
T: Sync,
impl<T> Unpin for LayoutNode<T>where
T: Unpin,
impl<T> UnwindSafe for LayoutNode<T>where
T: UnwindSafe,
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