-
Notifications
You must be signed in to change notification settings - Fork 4
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
🎁 [Feature Request]: feature to derive Debug on generated types #35
Comments
Instead of that, we can have a simpler solution. The macro for the struct I think this would be a more generalized approach. What do you think @jkneer ? |
Hi, yes that would be good, as currently the behaviour depends on the order of the annotations
-> Debug is derived on the struct
-> Debug is not derived. Hmm I guess that would be mostly ok, for Debug, Clone, Copy What if the trait cannot be derived? like Send or Sync? |
The macro does not change the struct name, one can always implement the traits manually. |
Wouldn't all State types also need carry those traits? |
Yes. As long as the generic type #[derive(Debug)]
struct MyStruct<T = bool> {
value: T,
}
fn main() {
let int_struct = MyStruct { value: 42 };
let string_struct = MyStruct { value: String::from("Hello") };
println!("{:?}", int_struct); // Works because i32 implements Debug
println!("{:?}", string_struct); // Works because String implements Debug
} |
What is the feature you would like to see?
When integrating a builder for a subaspect into another implementation for a larger struct, you may run into the situation where you have to explicitely return or take a stated type generated by state-shift. It would be nice to have Debug derives as a crate feature flag in those cases...
The text was updated successfully, but these errors were encountered: