diff options
Diffstat (limited to 'src/node.rs')
-rw-r--r-- | src/node.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/node.rs b/src/node.rs index 3e368ecb..1db10d7f 100644 --- a/src/node.rs +++ b/src/node.rs @@ -8,9 +8,9 @@ use crate::{Number, Size, Style}; /// runtime obtains a [`Node`] by calling [`Widget::node`]. /// /// [`Style`]: struct.Style.html -/// [`Widget`]: trait.Widget.html +/// [`Widget`]: widget/trait.Widget.html /// [`Node`]: struct.Node.html -/// [`Widget::node`]: trait.Widget.html#tymethod.node +/// [`Widget::node`]: widget/trait.Widget.html#tymethod.node /// [`Layout`]: struct.Layout.html #[derive(Debug)] pub struct Node(pub(crate) node::Node); @@ -24,17 +24,6 @@ impl Node { 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. /// /// This type of node cannot have any children. @@ -47,7 +36,7 @@ impl Node { /// /// [`Node`]: struct.Node.html /// [`Style`]: struct.Style.html - /// [`Widget`]: trait.Widget.html + /// [`Widget`]: widget/trait.Widget.html pub fn with_measure<F>(style: Style, measure: F) -> Node where F: 'static + Fn(Size<Number>) -> Size<f32>, @@ -57,4 +46,15 @@ impl Node { 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(), + )) + } } |