wip: fix issues with lifetimes

this commit fixes some lifetime issues regarding having to "move" data into the IntoVNode closure.
This commit is contained in:
Jonathan Kelley committed 2021-07-07 13:51:55 -04:00
1 parent 22e659c2bd
commit a38a81e129
39 files changed
+566 -255

No files matched your search

+20 -18
View File
@@ -1,27 +1,29 @@
fn main() {}
use dioxus_core as dioxus;
use dioxus_core::prelude::*;
mod dioxus_elements {
use super::*;
pub struct div;
impl DioxusElement for div {
const TAG_NAME: &'static str = "str";
const NAME_SPACE: Option<&'static str> = None;
}
}
static Example: FC<()> = |cx| {
cx.render(dioxus_core::prelude::LazyNodes::new(move |cx| {
let list = (0..10).map(|f| {
//
LazyNodes::new(move |f: NodeFactory| todo!())
});
cx.render(LazyNodes::new(move |cx| {
let bump = cx.bump();
dioxus_core::builder::ElementBuilder::new(cx, "h1")
.children([dioxus_core::builder::text3(bump, format_args!("hello"))])
.finish()
}))
};
struct Props {
text: String,
}
static Example2: FC<Props> = |cx| {
cx.render(dioxus_core::prelude::LazyNodes::new(move |__cx| {
let bump = __cx.bump();
dioxus_core::builder::ElementBuilder::new(__cx, "h1")
.children([dioxus_core::builder::text3(
bump,
format_args!("{}", cx.props.text),
)])
dioxus_core::builder::ElementBuilder::new(&cx, "h1")
.children([
cx.text(format_args!("hello")),
cx.text(format_args!("hello")),
cx.fragment_from_iter(list),
])
.finish()
}))
};