Skip to content
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

Suggestion: allow multiplying by a unit #366

Open
ttencate opened this issue Sep 1, 2022 · 2 comments
Open

Suggestion: allow multiplying by a unit #366

ttencate opened this issue Sep 1, 2022 · 2 comments

Comments

@ttencate
Copy link

ttencate commented Sep 1, 2022

The dimensioned crate allows us to multiply raw float values with a unit to produce a quantity:

let length: Meter<f64> = 3.0 * M;

In uom, this would look like:

let length: Length = 3.0 * meter;

Similarly, division f64 / Unit could be useful:

let frequency: Frequency = 5.0 / second;

For consistency, also allow Unit / f64:

let one_minute = hour / 60.0;

Essentially, a value that implements Unit could be used wherever a quantity of that dimension is expected.

@jacg
Copy link
Contributor

jacg commented Sep 1, 2022

I've been meaning to propose this for a few weeks now, just never got around to it!

@iliekturtles
Copy link
Owner

Thanks for submitting the issue. This goes along with #91, but I think should be tracked separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants