mirror of https://github.com/rm-dr/daisy
More units
parent
0cb171cde1
commit
356a3c7824
|
@ -22,7 +22,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "daisy"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"rug",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "daisy"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
|
||||
[profile.release]
|
||||
|
|
|
@ -33,6 +33,16 @@ pub enum UnitBase {
|
|||
Furlong,
|
||||
Mile,
|
||||
AstronomicalUnit,
|
||||
Lightyear,
|
||||
Parsec,
|
||||
|
||||
// Area
|
||||
Barn,
|
||||
Hectare,
|
||||
MilesPerHour,
|
||||
Acre,
|
||||
|
||||
|
||||
|
||||
// Time units
|
||||
Minute,
|
||||
|
@ -146,6 +156,12 @@ macro_rules! fromstring_db {
|
|||
(UnitBase::AstronomicalUnit, "AU"),
|
||||
(UnitBase::AstronomicalUnit, "astronomicalUnit"),
|
||||
(UnitBase::AstronomicalUnit, "astronomicalUnits"),
|
||||
(UnitBase::Lightyear, "ly"),
|
||||
(UnitBase::Lightyear, "lightyear"),
|
||||
(UnitBase::Lightyear, "lightyears"),
|
||||
(UnitBase::Parsec, "pc"),
|
||||
(UnitBase::Parsec, "parsec"),
|
||||
(UnitBase::Parsec, "parsecs"),
|
||||
|
||||
// Time
|
||||
(UnitBase::Second, "sec"),
|
||||
|
@ -172,6 +188,17 @@ macro_rules! fromstring_db {
|
|||
(UnitBase::JulianYear, "julianYear"),
|
||||
(UnitBase::JulianYear, "julianYears"),
|
||||
|
||||
// Misc
|
||||
(UnitBase::MilesPerHour, "mph"),
|
||||
(UnitBase::Barn, "b"),
|
||||
(UnitBase::Barn, "barn"),
|
||||
(UnitBase::Hectare, "ha"),
|
||||
(UnitBase::Hectare, "hectare"),
|
||||
(UnitBase::Hectare, "hectares"),
|
||||
(UnitBase::Acre, "acre"),
|
||||
(UnitBase::Acre, "acres"),
|
||||
|
||||
|
||||
// Volume
|
||||
(UnitBase::Liter, "liter"),
|
||||
(UnitBase::Liter, "liters"),
|
||||
|
@ -416,6 +443,46 @@ macro_rules! unit_db {
|
|||
(UnitBase::Meter, 1f64)
|
||||
),
|
||||
|
||||
UnitBase::Lightyear => $X!(
|
||||
UnitBase::Lightyear, "ly",
|
||||
rational, "9460730472580800",
|
||||
(UnitBase::Meter, 1f64)
|
||||
),
|
||||
|
||||
UnitBase::Parsec => $X!(
|
||||
UnitBase::Parsec, "pc",
|
||||
float, "3.085677581e16",
|
||||
(UnitBase::Meter, 1f64)
|
||||
),
|
||||
|
||||
|
||||
// Misc
|
||||
UnitBase::MilesPerHour => $X!(
|
||||
UnitBase::MilesPerHour, "mph",
|
||||
rational, "1609.344",
|
||||
(UnitBase::Meter, 1f64),
|
||||
(UnitBase::Second, -1f64)
|
||||
),
|
||||
|
||||
UnitBase::Barn => $X!(
|
||||
UnitBase::Barn, "b",
|
||||
rational, "1e-28",
|
||||
(UnitBase::Meter, 2f64)
|
||||
),
|
||||
|
||||
UnitBase::Hectare => $X!(
|
||||
UnitBase::Hectare, "ha",
|
||||
rational, "10000",
|
||||
(UnitBase::Meter, 2f64)
|
||||
),
|
||||
|
||||
UnitBase::Acre => $X!( // 66 x 660 feet
|
||||
UnitBase::Acre, "acre",
|
||||
rational, "4046.8564224",
|
||||
(UnitBase::Meter, 2f64)
|
||||
),
|
||||
|
||||
|
||||
|
||||
// Volume
|
||||
UnitBase::Liter => $X!(
|
||||
|
|
12
units.md
12
units.md
|
@ -1,8 +1,3 @@
|
|||
legal cup
|
||||
|
||||
| Unit | Syntax |
|
||||
|------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
|
||||
| [Barn](https://en.wikipedia.org/wiki/Barn_(unit)) | `barn` |
|
||||
| [Becquerel](https://en.wikipedia.org/wiki/Becquerel) | `becquerel`, `Bq` |
|
||||
| [Bel](https://en.wikipedia.org/wiki/Decibel) | `bel` |
|
||||
| [Bit](https://en.wikipedia.org/wiki/Bit) | `bits`, `bit` |
|
||||
|
@ -12,7 +7,6 @@ legal cup
|
|||
| [Calorie](https://en.wikipedia.org/wiki/Calorie) | `calories`, `calorie`, `cal` |
|
||||
| [Coulomb](https://en.wikipedia.org/wiki/Coulomb) | `coulomb`, `C` |
|
||||
| [DPI](https://en.wikipedia.org/wiki/Dots_per_inch) | `dpi` |
|
||||
| [Day](https://en.wikipedia.org/wiki/Day) | `days`, `day`, `d` |
|
||||
| [Degree](https://en.wikipedia.org/wiki/Degree_(angle)) | `degrees`, `degree`, `deg`, `°` |
|
||||
| [Dot](https://en.wikipedia.org/wiki/Dots_per_inch) | `dots`, `dot` |
|
||||
| [Electronvolt](https://en.wikipedia.org/wiki/Electronvolt) | `electronvolt`, `eV` |
|
||||
|
@ -22,22 +16,16 @@ legal cup
|
|||
| [Frames per second](https://en.wikipedia.org/wiki/Frame_rate) | `fps` |
|
||||
| [Gauss](https://en.wikipedia.org/wiki/Gauss_(unit)) | `gauss` |
|
||||
| [Gray](https://en.wikipedia.org/wiki/Gray_(unit)) | `gray`, `Gy` |
|
||||
| [Hectare](https://en.wikipedia.org/wiki/Hectare) | `hectare`, `ha` |
|
||||
| [Henry](https://en.wikipedia.org/wiki/Henry_(unit)) | `henrys`, `henries`, `henry`, `H` |
|
||||
| [Hertz](https://en.wikipedia.org/wiki/Hertz) | `hertz`, `Hz` |
|
||||
| [Joule](https://en.wikipedia.org/wiki/Joule) | `joules`, `joule`, `J` |
|
||||
| [Katal](https://en.wikipedia.org/wiki/Katal) | `katal`, `kat` |
|
||||
| [Kelvin](https://en.wikipedia.org/wiki/Kelvin) | `kelvin`, `K` |
|
||||
| [Light-year](https://en.wikipedia.org/wiki/Light-year) | `lightyears`, `lightyear`, `ly` |
|
||||
| [Lumen](https://en.wikipedia.org/wiki/Lumen_(unit)) | `lumen`, `lm` |
|
||||
| [Lux](https://en.wikipedia.org/wiki/Lux) | `lux`, `lx` |
|
||||
| [Miles per hour](https://en.wikipedia.org/wiki/Miles_per_hour) | `mph` |
|
||||
| [Millimeter of mercury](https://en.wikipedia.org/wiki/Millimeter_of_mercury) | `mmHg` |
|
||||
| [Newton](https://en.wikipedia.org/wiki/Newton_(unit)) | `newton`, `N` |
|
||||
| [Ohm](https://en.wikipedia.org/wiki/Ohm) | `ohms`, `ohm`, `Ω` |
|
||||
| [Ounce](https://en.wikipedia.org/wiki/Ounce) | `ounces`, `ounce`, `oz` |
|
||||
| [PPI](https://en.wikipedia.org/wiki/Pixels_per_inch) | `ppi` |
|
||||
| [Parsec](https://en.wikipedia.org/wiki/Parsec) | `parsecs`, `parsec`, `pc` |
|
||||
| [Parts-per-million](https://en.wikipedia.org/wiki/Parts-per_notation) | `ppm` |
|
||||
| [Parts-per-billion](https://en.wikipedia.org/wiki/Parts-per_notation) | `ppb` |
|
||||
| [Parts-per-trillion](https://en.wikipedia.org/wiki/Parts-per_notation) | `ppt` |
|
||||
|
|
Loading…
Reference in New Issue