Skip to content

Enforce values that must not be negative at a type level #207

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

Open
alice-i-cecile opened this issue Jul 25, 2022 · 1 comment · Fixed by #269
Open

Enforce values that must not be negative at a type level #207

alice-i-cecile opened this issue Jul 25, 2022 · 1 comment · Fixed by #269
Labels
good first issue Good for newcomers usability Make the library more comfortable to use

Comments

@alice-i-cecile
Copy link
Collaborator

What problem does this solve or what need does it fill?

Some values, such as flex_grow and flex_shrink, must not be negative, but are stored as a simple f32.

Documentation is a poor way to enforce this sort of constraint in Rust.

What solution would you like?

Use a non-negative float wrapper type. We can either hand-write this. or reuse an existing crate's work if something suitable exists.

Additional context

Noticed due to #206.

We should keep an eye out for other values that are similarly bounded as part of these changes.

@alice-i-cecile alice-i-cecile added good first issue Good for newcomers usability Make the library more comfortable to use labels Jul 25, 2022
@nicoburns
Copy link
Collaborator

Possibly shouldn't have listed this ticket in the PR description. This is NOT fixed by #269

@nicoburns nicoburns reopened this Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers usability Make the library more comfortable to use
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants