2021-03-12 20:41:36 +00:00
|
|
|
use dioxus_core::prelude::*;
|
2021-02-21 02:59:16 +00:00
|
|
|
|
2021-03-12 20:41:36 +00:00
|
|
|
#[derive(Debug, PartialEq, Props)]
|
2021-03-09 05:58:20 +00:00
|
|
|
struct SomeProps {
|
|
|
|
a: i32,
|
2021-02-21 02:59:16 +00:00
|
|
|
|
2021-03-09 05:58:20 +00:00
|
|
|
// automatically do the default (none) and automatically Into<T>
|
|
|
|
#[builder(default, setter(strip_option))]
|
|
|
|
b: Option<i32>,
|
2021-02-21 02:59:16 +00:00
|
|
|
}
|
|
|
|
|
2021-03-09 05:58:20 +00:00
|
|
|
fn main() {
|
|
|
|
let g: SomeProps = SomeProps::builder().a(10).b(10).build();
|
2021-02-21 02:59:16 +00:00
|
|
|
|
2021-03-11 00:42:31 +00:00
|
|
|
let _r = g.b.unwrap_or_else(|| 10);
|
2021-02-21 02:59:16 +00:00
|
|
|
}
|