jbaublitz/getset

get_mut should imply set, which should imply get

Boscop opened this issue · 1 comments

I'm using this crate a lot and it's making my struct definitions kinda verbose, so I propose this idea to reduce the verbosity:

Whenever a field has #[set], it should also automatically get a getter, and when it has get_mut it should automatically get a setter and getter, because get_mut already can be used as a setter but the actual set() should be generated for convenience. And we can assume that whenever a field has a setter, the author usually also wants it to have a getter as well. In those rare circumstances when that is not the case, the author can just write a manual setter instead of using the attribute.

What do you think?

I think in this particular case I'd rather avoid having implict magic. Similar to #3 I think exploring a more succinct syntax for the definition may be a better way.