Feat: props now autoderives its own trait
This commit is contained in:
1 parent
d4f1ceaffb
commit
b3c96a5996
10 files changed
+123
-83
No files matched your search
@@ -0,0 +1,19 @@
|
||||
fn main() {}
|
||||
|
||||
pub mod dioxus {
|
||||
pub mod prelude {
|
||||
pub trait Properties {
|
||||
type Builder;
|
||||
fn builder() -> Self::Builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(dioxus_core_macro::Props)]
|
||||
struct SomeProps {
|
||||
a: String,
|
||||
}
|
||||
|
||||
#[derive(dioxus_core_macro::Props)]
|
||||
struct SomePropsTwo<'a> {
|
||||
a: &'a str,
|
||||
}
|
||||
@@ -678,6 +678,14 @@ Finally, call `.build()` to create the instance of `{name}`.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl #impl_generics dioxus::prelude::Properties for #name #ty_generics{
|
||||
type Builder = #builder_name #generics_with_empty;
|
||||
fn builder() -> Self::Builder {
|
||||
#name::builder()
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1071,6 +1079,13 @@ Finally, call `.build()` to create the instance of `{name}`.
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
pub fn build_props_impl(&self) -> TokenStream {
|
||||
// SomeProps: #name
|
||||
// #builder_name
|
||||
// #generics_with_empty
|
||||
quote! {}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
|
||||
Reference in new issue
Block a user