Fix the router and stub out a number of crates to get compiling

This commit is contained in:
Jonathan Kelley committed 2024-01-13 20:51:37 -08:00
1 parent 4c6e515da4
commit fae0b08e61
226 files changed
+1057 -1482

No files matched your search

+26 -23
View File
@@ -25,42 +25,45 @@ criterion_group!(mbenches, create_rows);
criterion_main!(mbenches);
fn create_rows(c: &mut Criterion) {
fn app(cx: Scope) -> Element {
let mut rng = SmallRng::from_entropy();
render!(
table {
tbody {
(0..10_000_usize).map(|f| {
let label = Label::new(&mut rng);
rsx!( Row { row_id: f, label: label } )
})
}
}
)
}
c.bench_function("create rows", |b| {
let mut dom = VirtualDom::new(app);
let _ = dom.rebuild(&mut dioxus_core::NoOpMutations);
b.iter(|| {
let g = dom.rebuild();
let g = dom.rebuild(&mut ());
assert!(g.edits.len() > 1);
})
});
}
#[derive(PartialEq, Props)]
fn app() -> Element {
let mut rng = SmallRng::from_entropy();
rsx! (
table {
tbody {
for f in 0..10_000_usize {
table_row {
row_id: f,
label: Label::new(&mut rng)
}
}
}
}
)
}
#[derive(PartialEq, Props, Clone, Copy)]
struct RowProps {
row_id: usize,
label: Label,
}
fn Row(cx: Scope<RowProps>) -> Element {
let [adj, col, noun] = cx.props.label.0;
cx.render(rsx! {
fn table_row(props: RowProps) -> Element {
let [adj, col, noun] = props.label.0;
rsx! {
tr {
td { class:"col-md-1", "{cx.props.row_id}" }
td { class:"col-md-1", "{props.row_id}" }
td { class:"col-md-1", onclick: move |_| { /* run onselect */ },
a { class: "lbl", "{adj}" "{col}" "{noun}" }
}
@@ -71,10 +74,10 @@ fn Row(cx: Scope<RowProps>) -> Element {
}
td { class: "col-md-6" }
}
})
}
}
#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy)]
struct Label([&'static str; 3]);
impl Label {