-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
I have a project where I need to calculate the square of a Length value without turning it into an Area.
The code I have written currently is simplified as follows:
fn calc_score(ideal_width: Length, line_length: Length) -> Length{
let mut score = (ideal_width - line_length);
score.value = score.value * score.value;
score
}As you can see, I need to square the value of the unit, without changing the unit.
Is the way I accomplished this, the best way currently, or is there something I am missing within the documentation that will let me accomplish this in a more ergonomic way.
Thanks!
Score is used in a paragraph breaking algorithm which is why it is technically a length.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels