Implement get_int/get_bool for properties#391
Implement get_int/get_bool for properties#391Peternator7 merged 3 commits intoPeternator7:masterfrom
get_int/get_bool for properties#391Conversation
|
It might be a good idea to instead make it so each property carries its own type based on the syntax used to declare it (e.g. int properties declared as |
|
Hey @marxin, thanks for the PR! This has been requested for quite a while. I tend to agree with @pali6 though that this would probably be better if accepted literals of the expected type rather than parsing the string. In some ideal world, we could accept an expression |
8713af6 to
0fa010d
Compare
|
Here we go. I've implemented the suggested approach for the two functions. Eventually, I decided to track the 3 categories using HashMap in |
| fn get_bool(&self, _prop: &str) -> Option<bool> { | ||
| Option::None | ||
| } | ||
| fn get_int(&self, _prop: &str) -> Option<i64>; |
There was a problem hiding this comment.
Technically this is an API break. But also the old get_int did nothing so most likely no one used it and it is okay.
|
Looks great to me! thanks for taking the time to work on this :) |
|
Thanks for merging. May I ask you whether you plan to choke a new release any time soon? |
|
bump - @Peternator7 any plans for a new release soon? |
|
@Milo123459 You might've seen already but 0.27 has this change |
Fixes: #313
I am also suggesting to use
i64as return type forget_intin order to cover also negative numbers.