From 188c479c0fe3052dc3f786c00287729d5d5148cf Mon Sep 17 00:00:00 2001 From: Luca Lewin Date: Sat, 1 Apr 2023 18:40:50 +0200 Subject: [PATCH] add documentation to README.md --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 902f050..a239b6d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,32 @@ # Measurement Adds quantities and units to rust to allow unit safe computation + +## Define new quantity + +### Base Quantity + +```rust +quantity! { + name: Time, + base_unit: Second, + units: { + Second: 1e+0, + Millisecond: 1e-3, + } +} +``` + +### Derived Quantity + +```rust +quantity! { + name: Velocity, + base_unit: MeterPerSecond, + units: { + MeterPerSecond: 1, + KilometerPerHour: 3.6, + }, + derive: Length / Time, +} +```