diff --git a/crates/macro/src/html_tree/html_tag/mod.rs b/crates/macro/src/html_tree/html_tag/mod.rs
index 10bfb885e05..ee5e324c3b8 100644
--- a/crates/macro/src/html_tree/html_tag/mod.rs
+++ b/crates/macro/src/html_tree/html_tag/mod.rs
@@ -155,7 +155,7 @@ impl ToTokens for HtmlTag {
#vtag.add_attributes(vec![#(#attr_pairs),*]);
#vtag.add_listeners(vec![#(::std::boxed::Box::new(#listeners)),*]);
#vtag.add_children(vec![#(#children),*]);
- ::yew::virtual_dom::VNode::VTag(#vtag)
+ ::yew::virtual_dom::VNode::from(#vtag)
}});
}
}
diff --git a/examples/crm/README.md b/examples/crm/README.md
index 41cc08a1486..4be7a113408 100644
--- a/examples/crm/README.md
+++ b/examples/crm/README.md
@@ -4,3 +4,4 @@ The main goals of this demo example to show you how to:
* Add multiple screens with Yew (scenes)
* Use storage service
+* Generate VNodes without the html! macro
diff --git a/examples/crm/src/markdown.rs b/examples/crm/src/markdown.rs
index 1737a7abb3b..46db85aed72 100644
--- a/examples/crm/src/markdown.rs
+++ b/examples/crm/src/markdown.rs
@@ -73,7 +73,7 @@ where
}
if elems.len() == 1 {
- VNode::VTag(elems.pop().unwrap())
+ VNode::VTag(Box::new(elems.pop().unwrap()))
} else {
html! {
{ for elems.into_iter() }
diff --git a/src/virtual_dom/vnode.rs b/src/virtual_dom/vnode.rs
index 1523a5a5ee6..701763ecd08 100644
--- a/src/virtual_dom/vnode.rs
+++ b/src/virtual_dom/vnode.rs
@@ -8,10 +8,9 @@ use std::iter::FromIterator;
use stdweb::web::{Element, INode, Node};
/// Bind virtual element to a DOM reference.
-#[allow(clippy::large_enum_variant)] // ISSUE: #571
pub enum VNode {
/// A bind between `VTag` and `Element`.
- VTag(VTag),
+ VTag(Box>),
/// A bind between `VText` and `TextNode`.
VText(VText),
/// A bind between `VComp` and `Element`.
@@ -93,7 +92,7 @@ impl From> for VNode {
impl From> for VNode {
fn from(vtag: VTag) -> Self {
- VNode::VTag(vtag)
+ VNode::VTag(Box::new(vtag))
}
}
diff --git a/src/virtual_dom/vtag.rs b/src/virtual_dom/vtag.rs
index 4a258b9147e..de8c0f881a6 100644
--- a/src/virtual_dom/vtag.rs
+++ b/src/virtual_dom/vtag.rs
@@ -180,7 +180,7 @@ impl VTag {
/// Otherwise just add everything.
fn diff_classes<'a>(
&'a self,
- ancestor: &'a Option,
+ ancestor: &'a Option>,
) -> impl Iterator- > + 'a {
let to_add = {
let all_or_nothing = not(ancestor)
@@ -210,7 +210,7 @@ impl VTag {
/// the values are different.
fn diff_attributes<'a>(
&'a self,
- ancestor: &'a Option,
+ ancestor: &'a Option>,
) -> impl Iterator
- > + 'a {
// Only change what is necessary.
let to_add_or_replace =
@@ -236,7 +236,7 @@ impl VTag {
}
/// Similar to `diff_attributers` except there is only a single `kind`.
- fn diff_kind<'a>(&'a self, ancestor: &'a Option) -> Option> {
+ fn diff_kind<'a>(&'a self, ancestor: &'a Option>) -> Option> {
match (
self.kind.as_ref(),
ancestor.as_ref().and_then(|anc| anc.kind.as_ref()),
@@ -255,7 +255,7 @@ impl VTag {
}
/// Almost identical in spirit to `diff_kind`
- fn diff_value<'a>(&'a self, ancestor: &'a Option) -> Option> {
+ fn diff_value<'a>(&'a self, ancestor: &'a Option>) -> Option> {
match (
self.value.as_ref(),
ancestor.as_ref().and_then(|anc| anc.value.as_ref()),
@@ -273,7 +273,7 @@ impl VTag {
}
}
- fn apply_diffs(&mut self, element: &Element, ancestor: &Option) {
+ fn apply_diffs(&mut self, element: &Element, ancestor: &Option>) {
// Update parameters
let changes = self.diff_classes(ancestor);
for change in changes {