Make NumberOrPercentage and AngleOrNumber getters public.#357
Merged
tiaanl merged 1 commit intoservo:masterfrom Sep 1, 2023
Merged
Make NumberOrPercentage and AngleOrNumber getters public.#357tiaanl merged 1 commit intoservo:masterfrom
tiaanl merged 1 commit intoservo:masterfrom
Conversation
Because the structs are public it only make sense to make the getters public as well.
emilio
approved these changes
Sep 1, 2023
| impl NumberOrPercentage { | ||
| fn unit_value(&self) -> f32 { | ||
| /// Return the value as a percentage. | ||
| pub fn unit_value(&self) -> f32 { |
Member
There was a problem hiding this comment.
I think in the calc() code we call this unitless_value, maybe do the same for consistency?
Collaborator
Author
There was a problem hiding this comment.
unit_value comes from Token::Percentage { unit_value, .. }. Consistency can go either way here, so without having to swap the two methods around, because unitless value will now be the "other" one, I'd rather keep it as is for now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because the structs are public it only make sense to make the getters public as well.