Expose Node::with_children

This commit is contained in:
Héctor Ramón Jiménez 2019-08-30 01:55:53 +02:00
parent 2ebe09dacb
commit a666f70024

View file

@ -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(),
))
}
} }