-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New registry shape #4815
New registry shape #4815
Conversation
42f8632
to
c545daa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Praise: this is great! Glad it works
// This is a bit naughty, we need the marker's type, but we're actually | ||
// baking its value. This works as long as all markers are unit structs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, I was thinking whether we should make all our marker types be empty enums in v2, but here's a use case where we need them as a value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to redesign this, I don't like how we currently do it. The #[data_struct]
macro could add a non-self fn bake_type() -> TokenStream
to the marker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG after diffbase
Thought: The bake macro could generate a Of course what I want to use the #[if("MarkerA" != "MarkerB")]
#[if("MarkerA" != "MarkerC")]
impl DataProvider<MarkerA> for MyForkingProvider { ... }
#[if("MarkerB" != "MarkerB")]
#[if("MarkerB" != "MarkerC")]
impl DataProvider<MarkerB> for MyForkingProvider { ... }
#[if("MarkerC" != "MarkerB")]
#[if("MarkerC" != "MarkerC")]
impl DataProvider<MarkerC> for MyForkingProvider { ... }
#[if("MarkerD" != "MarkerB")]
#[if("MarkerD" != "MarkerC")]
impl DataProvider<MarkerD> for MyForkingProvider { ... } With that generated code, However, it's not immediately clear to me how to actually do this. We could probably make a custom proc macro to help, if one doesn't already exist. |
#4721