Skip to content

mickvangelderen/units

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demonstration of how one can use newtypes to prevent mixing up different quantities. In other words, a unit-of-measurement library.

This is not a production ready library. If you are looking for that, take a look at uom.

In my experience uom does take a while to compile, which is partially why I wanted to investigate what it would take to implement the functionality it provides. uom also takes care of printing and implementing traits from math interoperability crates. I also wanted to try and use const N: isize but Rust is not ready for that (can't use them in constant expressions as of Jan 2024). I ended up implementing compile-time counting as well to keep track of the different dimensions of the unit system.

About

Unit of measurement in Rust demonstration code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages