Expose Node::with_children
This commit is contained in:
parent
2ebe09dacb
commit
a666f70024
1 changed files with 11 additions and 11 deletions
22
src/node.rs
22
src/node.rs
|
|
@ -24,17 +24,6 @@ impl Node {
|
||||||
Self::with_children(style, Vec::new())
|
Self::with_children(style, Vec::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a new [`Node`] with the given [`Style`] and children.
|
|
||||||
///
|
|
||||||
/// [`Node`]: struct.Node.html
|
|
||||||
/// [`Style`]: struct.Style.html
|
|
||||||
pub(crate) fn with_children(style: Style, children: Vec<Node>) -> Node {
|
|
||||||
Node(node::Node::new(
|
|
||||||
style.0,
|
|
||||||
children.iter().map(|c| &c.0).collect(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a new [`Node`] with the given [`Style`] and a measure function.
|
/// Creates a new [`Node`] with the given [`Style`] and a measure function.
|
||||||
///
|
///
|
||||||
/// This type of node cannot have any children.
|
/// This type of node cannot have any children.
|
||||||
|
|
@ -57,4 +46,15 @@ impl Node {
|
||||||
Box::new(move |size| Ok(measure(size))),
|
Box::new(move |size| Ok(measure(size))),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Creates a new [`Node`] with the given [`Style`] and children.
|
||||||
|
///
|
||||||
|
/// [`Node`]: struct.Node.html
|
||||||
|
/// [`Style`]: struct.Style.html
|
||||||
|
pub fn with_children(style: Style, children: Vec<Node>) -> Node {
|
||||||
|
Node(node::Node::new(
|
||||||
|
style.0,
|
||||||
|
children.iter().map(|c| &c.0).collect(),
|
||||||
|
))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue