Open Luro02 opened 5 years ago
Great idea. :)
Just checked in, this is still unstable. :(
This is stable
const fn get_value(&self) -> &String {
&self.value
}
Correct, but the generic case is not. :(
Any updates to this? It doesn't seem reasonable to put this on hold just because of a special case. What about adding a feature gate or an attribute to enable const getters?
I was working on a rewrite of this lib to better support features like this, but it's not done yet.
You're welcome to contribute a patch to add this feature, or as always, write the getters and setters yourself (as is probably best!).
Most, if not all getters (generic function parameters are currently unstable) can be const functions https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn