wip: go back to noisy lifetime solution
This commit is contained in:
1 parent
0545d27182
commit
8daf7a6ed8
31 files changed
+214
-170
No files matched your search
@@ -20,7 +20,7 @@ fn main() {
|
||||
dioxus::desktop::launch(App, |c| c);
|
||||
}
|
||||
|
||||
fn App(cx: Context, props: &()) -> Element {
|
||||
fn App(cx: Scope, props: &()) -> Element {
|
||||
let text: &mut Vec<String> = cx.use_hook(|_| vec![String::from("abc=def")], |f| f);
|
||||
|
||||
let first = text.get_mut(0).unwrap();
|
||||
@@ -39,7 +39,7 @@ struct C1Props<'a> {
|
||||
text: &'a mut String,
|
||||
}
|
||||
|
||||
fn Child1(cx: Context, props: &C1Props) -> Element {
|
||||
fn Child1(cx: Scope, props: &C1Props) -> Element {
|
||||
let (left, right) = props.text.split_once("=").unwrap();
|
||||
|
||||
cx.render(rsx! {
|
||||
@@ -55,7 +55,7 @@ struct C2Props<'a> {
|
||||
text: &'a str,
|
||||
}
|
||||
|
||||
fn Child2(cx: Context, props: &C2Props) -> Element {
|
||||
fn Child2(cx: Scope, props: &C2Props) -> Element {
|
||||
cx.render(rsx! {
|
||||
Child3 {
|
||||
text: props.text
|
||||
@@ -68,7 +68,7 @@ struct C3Props<'a> {
|
||||
text: &'a str,
|
||||
}
|
||||
|
||||
fn Child3(cx: Context, props: &C3Props) -> Element {
|
||||
fn Child3(cx: Scope, props: &C3Props) -> Element {
|
||||
cx.render(rsx! {
|
||||
div { "{props.text}"}
|
||||
})
|
||||
|
||||
@@ -120,7 +120,7 @@ struct CalculatorKeyProps<'a> {
|
||||
children: Element,
|
||||
}
|
||||
|
||||
fn CalculatorKey<'a>(cx: Context, props: &CalculatorKeyProps) -> Element {
|
||||
fn CalculatorKey<'a>(cx: Scope, props: &CalculatorKeyProps) -> Element {
|
||||
rsx!(cx, button {
|
||||
class: "calculator-key {props.name}"
|
||||
onclick: {props.onclick}
|
||||
|
||||
@@ -61,7 +61,7 @@ struct HorseyProps<'a> {
|
||||
children: ScopeChildren<'a>,
|
||||
}
|
||||
|
||||
fn Horsey<'a>((cx, props): Scope<'a, HorseyProps<'a>>) -> Element {
|
||||
fn Horsey<'a>((cx, props): ScopeState<'a, HorseyProps<'a>>) -> Element {
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
button { "pause" }
|
||||
|
||||
@@ -95,7 +95,7 @@ struct ActionButtonProps<'a> {
|
||||
onclick: &'a dyn Fn(),
|
||||
}
|
||||
|
||||
fn ActionButton(cx: Context, props: &ActionButtonProps) -> Element {
|
||||
fn ActionButton(cx: Scope, props: &ActionButtonProps) -> Element {
|
||||
rsx!(cx, div { class: "col-sm-6 smallpad"
|
||||
button { class:"btn btn-primary btn-block", r#type: "button", id: "{props.id}", onclick: move |_| (props.onclick)(),
|
||||
"{props.name}"
|
||||
|
||||
@@ -4,7 +4,7 @@ fn main() {
|
||||
dioxus::desktop::launch(App, |c| c);
|
||||
}
|
||||
|
||||
fn App((cx, props): Scope<()>) -> Element {
|
||||
fn App((cx, props): ScopeState<()>) -> Element {
|
||||
cx.render(rsx! (
|
||||
div { "Hello, world!" }
|
||||
))
|
||||
|
||||
@@ -77,7 +77,7 @@ struct CalculatorKeyProps<'a> {
|
||||
children: ScopeChildren<'a>,
|
||||
}
|
||||
|
||||
fn CalculatorKey<'a>((cx, props): Scope<'a, CalculatorKeyProps<'a>>) -> Element<'a> {
|
||||
fn CalculatorKey<'a>((cx, props): ScopeState<'a, CalculatorKeyProps<'a>>) -> Element<'a> {
|
||||
cx.render(rsx! {
|
||||
button {
|
||||
class: "calculator-key {props.name}"
|
||||
|
||||
@@ -178,7 +178,7 @@ pub static Example: Component<()> = |cx, props| {
|
||||
})
|
||||
};
|
||||
|
||||
fn helper(cx: Context, text: &str) -> Element {
|
||||
fn helper(cx: Scope, text: &str) -> Element {
|
||||
rsx!(cx, p { "{text}" })
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ mod baller {
|
||||
pub struct BallerProps {}
|
||||
|
||||
/// This component totally balls
|
||||
pub fn Baller(_: Scope<BallerProps>) -> Element {
|
||||
pub fn Baller(_: ScopeState<BallerProps>) -> Element {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ pub struct TallerProps<'a> {
|
||||
}
|
||||
|
||||
/// This component is taller than most :)
|
||||
pub fn Taller<'a>(_: Scope<'a, TallerProps<'a>>) -> Element {
|
||||
pub fn Taller<'a>(_: ScopeState<'a, TallerProps<'a>>) -> Element {
|
||||
let b = true;
|
||||
todo!()
|
||||
}
|
||||
+1
-1
@@ -21,6 +21,6 @@ static App: Component<()> = |cx, props| {
|
||||
struct MyProps<'a> {
|
||||
text: &'a str,
|
||||
}
|
||||
fn App2(cx: Context, props: &MyProps) -> Element {
|
||||
fn App2(cx: Scope, props: &MyProps) -> Element {
|
||||
None
|
||||
}
|
||||
+1
-1
@@ -85,7 +85,7 @@ pub struct TodoEntryProps {
|
||||
todo: Rc<TodoItem>,
|
||||
}
|
||||
|
||||
pub fn TodoEntry(cx: Context, props: &TodoEntryProps) -> Element {
|
||||
pub fn TodoEntry(cx: Scope, props: &TodoEntryProps) -> Element {
|
||||
let mut is_editing = use_state(cx, || false);
|
||||
let mut 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): Scope<RowProps>) -> Element {
|
||||
fn Row((cx, props): ScopeState<RowProps>) -> Element {
|
||||
let [adj, col, noun] = props.label.0;
|
||||
cx.render(rsx! {
|
||||
tr {
|
||||
|
||||
Reference in new issue
Block a user