sokomishalov/lombok-rs

[Feature] Provide getter_mut?

NobodyXu opened this issue · 1 comments

According to How to avoid writing duplicate accessor functions for mutable and immutable references in Rust?, there's currently no easy tool in rust for defining immutable and mutable getter without copying the function definition twice.

lombok could fill this gap with a new macro get_mut.

It can also provide a macro for implementing get_* and get_*_mut at the same time, but only require the type once, though due to the explicit &mut requirement, this might not be that helpful as get_mut macro.

That feature definitely makes sense.
I've implemented and released a new minor version.
Thanks for raising it!