From 98dffc8090133f6dc927a3df3384c4fb7b649e3c Mon Sep 17 00:00:00 2001 From: tehforsch Date: Sun, 25 Feb 2024 14:53:07 +0100 Subject: [PATCH] update docs --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index a39ed18..ce4e236 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ //! ``` //! # #![feature(generic_const_exprs)] //! use diman::si::dimensions::{Length, Time, Velocity}; -//! use diman::si::units::{seconds, meters, kilometers, hours}; +//! use diman::si::units::{seconds, meters, kilometers, hours, hour}; //! //! fn get_velocity(x: Length, t: Time) -> Velocity { //! x / t @@ -13,9 +13,10 @@ //! let v2 = get_velocity(10.0 * meters, 1.0 * seconds); //! //! assert_eq!(v1, v2); +//! assert_eq!(format!("{} km/h", v1.value_in(kilometers / hour)), "36 km/h"); //! ``` //! -//! Let's try to add quantities with incompatible dimensions: +//! Diman prevents unit errors at compile time: //! ```compile_fail //! # use diman::si::units::{seconds, meters}; //! let time = 1.0 * seconds;