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
@@ -69,13 +69,6 @@ impl PartialEq for ChildProps<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Properties for ChildProps<'a> {
|
||||
type Builder = ChildPropsBuilder<'a, ((), ())>;
|
||||
fn builder() -> <Self as Properties>::Builder {
|
||||
ChildProps::builder()
|
||||
}
|
||||
}
|
||||
|
||||
fn ChildItem(_ctx: Context, _props: &ChildProps) -> DomTree {
|
||||
todo!()
|
||||
// ctx.render(rsx! {
|
||||
|
||||
@@ -24,10 +24,3 @@ static SomeComponent: FC<ExampleProps> = |ctx, _props| {
|
||||
};
|
||||
|
||||
fn main() {}
|
||||
|
||||
impl Properties for ExampleProps {
|
||||
type Builder = ExamplePropsBuilder<((),)>;
|
||||
fn builder() -> Self::Builder {
|
||||
ExampleProps::builder()
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
use dioxus_core_macro::Props;
|
||||
use dioxus_core::prelude::*;
|
||||
|
||||
#[derive(Debug, Props)]
|
||||
#[derive(Debug, PartialEq, Props)]
|
||||
struct SomeProps {
|
||||
a: i32,
|
||||
|
||||
@@ -9,12 +9,8 @@ struct SomeProps {
|
||||
b: Option<i32>,
|
||||
}
|
||||
|
||||
// have we committed to the trait style yet?
|
||||
|
||||
fn main() {
|
||||
let g: SomeProps = SomeProps::builder().a(10).b(10).build();
|
||||
|
||||
let _r = g.b.unwrap_or_else(|| 10);
|
||||
}
|
||||
|
||||
fn auto_into_some() {}
|
||||
@@ -23,11 +23,3 @@ static Example: FC<SomeProps> = |ctx, _props| {
|
||||
</div>
|
||||
})
|
||||
};
|
||||
|
||||
// toodo: derive this
|
||||
impl Properties for SomeProps {
|
||||
type Builder = SomePropsBuilder<((),)>;
|
||||
fn builder() -> Self::Builder {
|
||||
SomeProps::builder()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user