paholg / dimensioned

Compile-time dimensional analysis for various unit systems using Rust's type system.
https://crates.io/crates/dimensioned
MIT License
300 stars 23 forks source link

create Abs trait for absolute value #41

Closed droundy closed 6 years ago

droundy commented 6 years ago

I wrote this very quickly, so please do check that I haven't missed anything. It's just got the one example as a test.

droundy commented 6 years ago

Do you do special case implementations like that for any other methods? It seems potentially very appealing, but I'd think that consistency would be key.

paholg commented 6 years ago

I don't think so. I think it just hadn't occurred to me before.

I think it would be worth adding for at least anything we have a trait for, as well as any other methods that exists on primitives.

I would happily accept such a PR, or may make one myself at some point.