wip: move everything over to a stack dst
This commit is contained in:
1 parent
12a9758c3c
commit
0e9d5fc530
36 files changed
+224
-185
No files matched your search
@@ -20,7 +20,7 @@ fn main() {
|
||||
dioxus::desktop::launch(App, |c| c);
|
||||
}
|
||||
|
||||
fn App((cx, props): Component<()>) -> DomTree {
|
||||
fn App((cx, props): Component<()>) -> Element {
|
||||
let text: &mut Vec<String> = cx.use_hook(|_| vec![String::from("abc=def")], |f| f, |_| {});
|
||||
|
||||
let first = text.get_mut(0).unwrap();
|
||||
@@ -43,7 +43,7 @@ impl<'a> Drop for C1Props<'a> {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
|
||||
fn Child1<'a>((cx, props): Component<'a, C1Props>) -> DomTree<'a> {
|
||||
fn Child1<'a>((cx, props): Component<'a, C1Props>) -> Element<'a> {
|
||||
let (left, right) = props.text.split_once("=").unwrap();
|
||||
|
||||
cx.render(rsx! {
|
||||
@@ -59,7 +59,7 @@ struct C2Props<'a> {
|
||||
text: &'a str,
|
||||
}
|
||||
|
||||
fn Child2<'a>((cx, props): Component<'a, C2Props>) -> DomTree<'a> {
|
||||
fn Child2<'a>((cx, props): Component<'a, C2Props>) -> Element<'a> {
|
||||
cx.render(rsx! {
|
||||
Child3 {
|
||||
text: props.text
|
||||
@@ -72,7 +72,7 @@ struct C3Props<'a> {
|
||||
text: &'a str,
|
||||
}
|
||||
|
||||
fn Child3<'a>((cx, props): Component<'a, C3Props>) -> DomTree<'a> {
|
||||
fn Child3<'a>((cx, props): Component<'a, C3Props>) -> Element<'a> {
|
||||
cx.render(rsx! {
|
||||
div { "{props.text}"}
|
||||
})
|
||||
|
||||
@@ -116,7 +116,7 @@ struct CalculatorKeyProps<'a> {
|
||||
onclick: &'a dyn Fn(MouseEvent),
|
||||
}
|
||||
|
||||
fn CalculatorKey<'a>((cx, props): Component<'a, CalculatorKeyProps>) -> DomTree<'a> {
|
||||
fn CalculatorKey<'a>((cx, props): Component<'a, CalculatorKeyProps>) -> Element<'a> {
|
||||
rsx!(cx, button {
|
||||
class: "calculator-key {props.name}"
|
||||
onclick: {props.onclick}
|
||||
|
||||
@@ -80,7 +80,7 @@ struct ActionButtonProps<'a> {
|
||||
onclick: &'a dyn Fn(MouseEvent),
|
||||
}
|
||||
|
||||
fn ActionButton<'a>((cx, props): Component<'a, ActionButtonProps>) -> DomTree<'a> {
|
||||
fn ActionButton<'a>((cx, props): Component<'a, ActionButtonProps>) -> Element<'a> {
|
||||
rsx!(cx, div { class: "col-sm-6 smallpad"
|
||||
button { class:"btn btn-primary btn-block", r#type: "button", id: "{props.id}", onclick: {props.onclick},
|
||||
"{props.name}"
|
||||
@@ -93,7 +93,7 @@ struct RowProps {
|
||||
row_id: usize,
|
||||
label: Rc<str>,
|
||||
}
|
||||
fn Row((cx, props): Component<RowProps>) -> DomTree {
|
||||
fn Row((cx, props): Component<RowProps>) -> Element {
|
||||
rsx!(cx, tr {
|
||||
td { class:"col-md-1", "{props.row_id}" }
|
||||
td { class:"col-md-1", onclick: move |_| { /* run onselect */ }
|
||||
|
||||
@@ -4,7 +4,7 @@ fn main() {
|
||||
dioxus::desktop::launch(App, |c| c);
|
||||
}
|
||||
|
||||
fn App((cx, props): Component<()>) -> DomTree {
|
||||
fn App((cx, props): Component<()>) -> Element {
|
||||
cx.render(rsx! (
|
||||
div { "Hello, world!" }
|
||||
))
|
||||
|
||||
@@ -76,7 +76,7 @@ struct CalculatorKeyProps<'a> {
|
||||
onclick: &'a dyn Fn(MouseEvent),
|
||||
}
|
||||
|
||||
fn CalculatorKey<'a>((cx, props): Component<'a, CalculatorKeyProps>) -> DomTree<'a> {
|
||||
fn CalculatorKey<'a>((cx, props): Component<'a, CalculatorKeyProps>) -> Element<'a> {
|
||||
cx.render(rsx! {
|
||||
button {
|
||||
class: "calculator-key {props.name}"
|
||||
|
||||
@@ -184,7 +184,7 @@ mod baller {
|
||||
pub struct BallerProps {}
|
||||
|
||||
/// This component totally balls
|
||||
pub fn Baller(_: Component<BallerProps>) -> DomTree {
|
||||
pub fn Baller(_: Component<BallerProps>) -> Element {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ pub struct TallerProps {
|
||||
}
|
||||
|
||||
/// This component is taller than most :)
|
||||
pub fn Taller(_: Component<TallerProps>) -> DomTree {
|
||||
pub fn Taller(_: Component<TallerProps>) -> Element {
|
||||
let b = true;
|
||||
todo!()
|
||||
}
|
||||
+1
-1
@@ -21,6 +21,6 @@ static App: FC<()> = |(cx, props)| {
|
||||
struct MyProps<'a> {
|
||||
text: &'a str,
|
||||
}
|
||||
fn App2<'a>(cx: Context<'a>, props: &'a MyProps) -> DomTree<'a> {
|
||||
fn App2<'a>(cx: Context<'a>, props: &'a MyProps) -> Element<'a> {
|
||||
None
|
||||
}
|
||||
+1
-1
@@ -85,7 +85,7 @@ pub struct TodoEntryProps {
|
||||
todo: Rc<TodoItem>,
|
||||
}
|
||||
|
||||
pub fn TodoEntry((cx, props): Component<TodoEntryProps>) -> DomTree {
|
||||
pub fn TodoEntry((cx, props): Component<TodoEntryProps>) -> Element {
|
||||
let is_editing = use_state(cx, || false);
|
||||
let contents = use_state(cx, || String::from(""));
|
||||
let todo = &props.todo;
|
||||
|
||||
@@ -45,7 +45,7 @@ struct RowProps {
|
||||
row_id: usize,
|
||||
label: Label,
|
||||
}
|
||||
fn Row((cx, props): Component<RowProps>) -> DomTree {
|
||||
fn Row((cx, props): Component<RowProps>) -> Element {
|
||||
let [adj, col, noun] = props.label.0;
|
||||
cx.render(rsx! {
|
||||
tr {
|
||||
|
||||
Reference in new issue
Block a user