2023-04-23 16:54:40 +00:00
|
|
|
use std::fmt::Display;
|
|
|
|
|
2022-11-16 04:58:56 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
dioxus_desktop::launch(app);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn app(cx: Scope) -> Element {
|
2024-01-11 20:11:27 +00:00
|
|
|
render! {
|
|
|
|
generic_child { data: 0 }
|
|
|
|
}
|
2023-04-23 16:54:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(PartialEq, Props)]
|
|
|
|
struct GenericChildProps<T: Display + PartialEq> {
|
|
|
|
data: T,
|
2022-11-16 04:58:56 +00:00
|
|
|
}
|
|
|
|
|
2023-04-23 16:54:40 +00:00
|
|
|
fn generic_child<T: Display + PartialEq>(cx: Scope<GenericChildProps<T>>) -> Element {
|
2024-01-11 20:11:27 +00:00
|
|
|
render! {
|
|
|
|
div { "{&cx.props.data}" }
|
|
|
|
}
|
2022-11-16 04:58:56 +00:00
|
|
|
}
|