props.rs 414 B

1234567891011121314151617181920
  1. use dioxus_core_macro::Props;
  2. #[derive(Debug, Props)]
  3. struct SomeProps {
  4. a: i32,
  5. // automatically do the default (none) and automatically Into<T>
  6. #[builder(default, setter(strip_option))]
  7. b: Option<i32>,
  8. }
  9. // have we committed to the trait style yet?
  10. fn main() {
  11. let g: SomeProps = SomeProps::builder().a(10).b(10).build();
  12. let r = g.b.unwrap_or_else(|| 10);
  13. }
  14. fn auto_into_some() {}