wip: go back to noisy lifetime solution

This commit is contained in:
Jonathan Kelley committed 2021-12-14 02:27:59 -05:00
1 parent 0545d27182
commit 8daf7a6ed8
31 files changed
+214 -170

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
use dioxus::prelude::*;
use dioxus_core as dioxus;
use dioxus_core_macro::*;
use dioxus_html as dioxus_elements;
fn main() {}
fn App(cx: Scope<()>) -> Element {
cx.render(rsx!(div {
App2 {
p: "asd"
}
}))
}
#[derive(Props)]
struct Borrowed<'a> {
p: &'a str,
}
fn App2<'a>(cx: Scope<'a, Borrowed<'a>>) -> Element {
let g = eat2(&cx);
todo!()
}
fn eat2(s: &ScopeState) {}
fn eat(f: &str) {}
fn bleat() {
let blah = String::from("asd");
eat(&blah);
}
// struct Lower {}
// #[derive(Clone, Copy)]
// struct Upper {}
// impl std::ops::Deref for Upper {
// type Target = Lower;
// fn deref(&self) -> &Self::Target {
// todo!()
// }
// }
// fn mark(f: &Lower) {}
// fn bark() {
// let up = Upper {};
// mark(&up);
// }
+2 -6
View File
@@ -9,7 +9,7 @@ fn main() {
let _ = VirtualDom::new(App);
}
fn App(cx: Context, _props: &()) -> Element {
fn App(cx: Scope<()>) -> Element {
//
cx.render(rsx!(
div {
@@ -18,11 +18,7 @@ fn App(cx: Context, _props: &()) -> Element {
))
}
struct ChildProps<'a> {
click_handler: EventHandler<'a>,
}
fn Child(cx: Context, _props: &()) -> Element {
fn Child(cx: Scope<()>) -> Element {
//
cx.render(rsx!(
div {
+1 -1
View File
@@ -50,7 +50,7 @@ struct RowProps {
row_id: usize,
label: Label,
}
fn Row(cx: Context, props: &RowProps) -> Element {
fn Row(cx: Scope, props: &RowProps) -> Element {
let [adj, col, noun] = props.label.0;
cx.render(rsx! {
tr {
+3 -3
View File
@@ -9,7 +9,7 @@ fn main() {
let _ = VirtualDom::new(Parent);
}
fn Parent(cx: Context, _props: &()) -> Element {
fn Parent(cx: Scope, _props: &()) -> Element {
let value = cx.use_hook(|_| String::new(), |f| f);
cx.render(rsx! {
@@ -25,7 +25,7 @@ struct ChildProps<'a> {
name: &'a str,
}
fn Child(cx: Context, props: &ChildProps) -> Element {
fn Child(cx: Scope, props: &ChildProps) -> Element {
cx.render(rsx! {
div {
h1 { "it's nested" }
@@ -39,7 +39,7 @@ struct Grandchild<'a> {
name: &'a str,
}
fn Child2(cx: Context, props: &Grandchild) -> Element {
fn Child2(cx: Scope, props: &Grandchild) -> Element {
cx.render(rsx! {
div { "Hello {props.name}!" }
})