Return primitive types by value from getters#12
Return primitive types by value from getters#12Dushistov wants to merge 4 commits intojbaublitz:masterfrom
Conversation
to reduce formating noise just use standard formating
This version used by serde, so it would be nice to not have the same packages with different versions as dependency.
|
It wouldn't work for type aliases: type Float = f32;
#[derive(Getters)]
struct Foo {
#[get]
x: Float
}proc-macros can't know whether a field type is With this syntax, it would be useable also for type aliases and non-primitive small structs like |
|
Yes, it doesn't handle type aliases, also |
|
I agree that it would be nice to have both: use copying by default for primitives, and still have the special syntax to be able to also use it for type aliases and non-primitive Btw, why are you using a |
Hoverbear
left a comment
There was a problem hiding this comment.
Oh this is a neat refactor. I generally prefer such a big refactor to be done on its own, and not bundled in with a feature PR.
Could you open the refactor (ae15db6) as its own PR?
I'd rather review it (and merge it) seperately, and I feel like this PR will take awhile to properly spec out.
|
|
@Dushistov Thanks! :) Could you rebase this now? |
Not sure about that, actually not sure that this PR is the way to go right now. In my fork I modify And for me such However, after all modifications I am still unhappy about tons of that I have to write. So my plan (when I'd have some free time) is to discuss this problem |
|
@Dushistov Please, take your time. :) It'd be great to do this the right way! |
|
@Dushistov Yes, I agree with you, one way to reduce the amount of typing for |
|
Selectively having certain Copy types dereferenced and some not looks really confusing and inconsistent. Is it so hard to do a |
|
I think #29 is a simpler solution to this without any magic. What do you think? |
|
Closing this. :) Feel free to reopen if you'd prefer. |
No description provided.