wip: clean up using new children syntax

This commit is contained in:
Jonathan Kelley committed 2021-11-01 03:29:50 -04:00
1 parent d4192d0de2
commit 9c1343610b
6 files changed
+96 -85

No files matched your search

+16
View File
@@ -155,6 +155,22 @@ impl<'src> VNode<'src> {
VNode::Component(_) => None,
}
}
// Create an "owned" version of the vnode.
pub fn decouple(&self) -> VNode<'src> {
match self {
VNode::Text(t) => VNode::Text(*t),
VNode::Element(e) => VNode::Element(*e),
VNode::Component(c) => VNode::Component(*c),
VNode::Suspended(s) => VNode::Suspended(*s),
VNode::Anchor(a) => VNode::Anchor(*a),
VNode::Fragment(f) => VNode::Fragment(VFragment {
children: f.children,
key: f.key,
is_static: f.is_static,
}),
}
}
}
/// A placeholder node only generated when Fragments don't have any children.