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 20)
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
fn container<P, C>(s: Scope<P>, style: Style, content: C)
where
P: 'static,
C: Fn(Scope<Container>) + Clone + 'static,
{
let scope = s.child::<Container>();
s.create_node(
scope,
content,
move |_| style.clone(),
|style, _| LayoutNode::new(style),
|n, style, _| {
if n.style != style {
n.style = style;
}
},
);
}
struct Leaf;
#[track_caller]
fn leaf<P>(s: Scope<P>, style: Style)
where
P: 'static,
{
let scope = s.child::<Leaf>();
s.create_node(
scope,
|_| {},
move |_| style.clone(),
|style, _| LayoutNode::new(style),
|n, style, _| {
if n.style != style {
n.style = style;
n.mark_dirty();
}
},
);
}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 44)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
fn leaf<P>(s: Scope<P>, style: Style)
where
P: 'static,
{
let scope = s.child::<Leaf>();
s.create_node(
scope,
|_| {},
move |_| style.clone(),
|style, _| LayoutNode::new(style),
|n, style, _| {
if n.style != style {
n.style = style;
n.mark_dirty();
}
},
);
}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 copy 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
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