#what is the trait that #[derive(Props)] satisfies?

4 messages · Page 1 of 1 (latest)

opal pulsar
#

I'd like to require a generic to have derived Props, like <T: Props> but I'm newish to traits and macros and having trouble finding the name of the trait from the macro code

glad hatch
#

I'm also new, but have been doing a lot digging lately on macros and dioxus.
https://github.com/DioxusLabs/dioxus/blob/master/packages/core-macro/src/lib.rs#L31-L38
This is where the props macro seems to be defined. Most of the logic for it is in the impl_my_derive function here: https://github.com/DioxusLabs/dioxus/blob/master/packages/core-macro/src/props/mod.rs#L16-L64 .
I've also found it incredibly useful to have rust_analyser enabled on your IDE. Then you can click on the Props in #[derive(Props)] and type Expand macro recursively, it may take a while, but it expands your prop into what the macro would generate. It's implementing a whole host of things - try it on a simple prop to see a 'simpler' definition of it

glad hatch
opal pulsar
#

Properties! makes a lot of sense. It's working, thanks for the help!!