-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement get_int
/get_bool
for properties
#391
Implement get_int
/get_bool
for properties
#391
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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? |
Fixes: #313
I am also suggesting to use
i64
as return type forget_int
in order to cover also negative numbers.