wip: major cleanups to scheduler

This commit is contained in:
Jonathan Kelley committed 2021-11-06 23:11:17 -04:00
1 parent d96276a715
commit 2933e4bc11
36 files changed
+641 -663

No files matched your search

+1 -1
View File
@@ -21,7 +21,7 @@ fn main() {
}
fn App((cx, props): Scope<()>) -> Element {
let text: &mut Vec<String> = cx.use_hook(|_| vec![String::from("abc=def")], |f| f, |_| {});
let text: &mut Vec<String> = cx.use_hook(|_| vec![String::from("abc=def")], |f| f);
let first = text.get_mut(0).unwrap();
+13 -11
View File
@@ -90,15 +90,17 @@ static App: FC<()> = |(cx, _)| {
}
};
rsx!(cx, body {
link {
rel: "stylesheet"
href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css"
integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5"
crossorigin: "anonymous"
}
margin_left: "35%"
h1 {"Dioxus CRM Example"}
{scene}
})
cx.render(rsx!(
body {
link {
rel: "stylesheet"
href: "https://unpkg.com/purecss@2.0.6/build/pure-min.css"
integrity: "sha384-Uu6IeWbM+gzNVXJcM9XV3SohHtmWE+3VGi496jvgX1jyvDTXfdK+rfZc8C1Aehk5"
crossorigin: "anonymous"
}
margin_left: "35%"
h1 {"Dioxus CRM Example"}
{scene}
}
))
};
+9 -5
View File
@@ -102,12 +102,9 @@ pub static Example: FC<()> = |(cx, props)| {
}}
// Matching
// Matching will throw a Rust error about "no two closures are the same type"
// To fix this, call "render" method or use the "in" syntax to produce VNodes.
// There's nothing we can do about it, sorry :/ (unless you want *really* unhygienic macros)
{match true {
true => rsx!(cx, h1 {"Top text"}),
false => cx.render(rsx!( h1 {"Bottom text"}))
true => rsx!( h1 {"Top text"}),
false => rsx!( h1 {"Bottom text"})
}}
// Conditional rendering
@@ -174,10 +171,17 @@ pub static Example: FC<()> = |(cx, props)| {
// Can take children too!
Taller { a: "asd", div {"hello world!"} }
// helper functions
{helper(cx, "hello world!")}
}
})
};
fn helper(cx: Context, text: &str) -> Element {
rsx!(cx, p { "{text}" })
}
mod baller {
use super::*;
#[derive(Props, PartialEq)]
+1 -1
View File
@@ -21,6 +21,6 @@ static App: FC<()> = |(cx, props)| {
struct MyProps<'a> {
text: &'a str,
}
fn App2<'a>(cx: Context<'a>, props: &'a MyProps) -> Element<'a> {
fn App2(cx: Context, props: &MyProps) -> Element {
None
}
+6 -4
View File
@@ -24,14 +24,16 @@ static App: FC<()> = |(cx, props)| {
.await
.unwrap();
},
|cx, props| {
|props| {
//
rsx!(WeatherDisplay {})
cx.render(rsx!(WeatherDisplay {}))
},
);
rsx!(cx, div {
{body}
cx.render(rsx! {
div {
{body}
}
})
};