fix: use annotation method from rust/58052 to fix closure lifetimes

This commit is contained in:
Jonathan Kelley committed 2021-10-30 18:23:28 -04:00
1 parent 9ee2bfb010
commit 27d891934a
15 files changed
+333 -180

No files matched your search

+11 -3
View File
@@ -1,4 +1,7 @@
use dioxus_core::prelude::*;
use dioxus_core_macro::format_args_f;
use dioxus_core_macro::rsx;
use dioxus_html as dioxus_elements;
fn main() {
let mut dom = VirtualDom::new(EXAMPLE);
@@ -7,9 +10,14 @@ fn main() {
}
pub static EXAMPLE: FC<()> = |(cx, _)| {
let list = (0..10).map(|_f| LazyNodes::new(move |_f| todo!()));
let list = (0..10).map(|_f| {
rsx! {
"{_f}"
}
});
// let list = (0..10).map(|_f| Some(Box::new(move |_f| todo!())));
cx.render(LazyNodes::new(move |cx| {
cx.render(Some(Box::new(move |cx| {
cx.raw_element(
"div",
None,
@@ -22,5 +30,5 @@ pub static EXAMPLE: FC<()> = |(cx, _)| {
],
None,
)
}))
})))
};