From c237c02f6923470e4b67cbcca5317115361c8af2 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Wed, 15 Jan 2025 14:03:18 +0100 Subject: [PATCH] docs: quantity-safety mentioned in the docs --- docs/index.md | 3 +++ .../framework_basics/simple_and_typed_quantities.md | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/index.md b/docs/index.md index 260316e1..43e1370c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,6 +10,9 @@ hide: provides compile-time dimensional analysis and unit/quantity manipulation. Its key strengths include safety, performance, and developer experience. +It is the first library on the market that, besides being **unit-safe** and **dimension-safe**, +is also **quantity-safe**. + The library source code is hosted on [GitHub](https://github.com/mpusz/mp-units) with a permissive [MIT license](https://github.com/mpusz/units/blob/master/LICENSE.md). diff --git a/docs/users_guide/framework_basics/simple_and_typed_quantities.md b/docs/users_guide/framework_basics/simple_and_typed_quantities.md index dd7ee228..41f6d567 100644 --- a/docs/users_guide/framework_basics/simple_and_typed_quantities.md +++ b/docs/users_guide/framework_basics/simple_and_typed_quantities.md @@ -165,10 +165,9 @@ error: no viable conversion from returned value of type ## Typed quantities -Simple mode is all about and just about units. In case we care about a specific quantity type, -**typed quantities** should be preferred. With this mode, for example, we can specify if we -deal with _width_, _height_, or _radius_ and ensure we will not assign one to another by -accident. +Simple mode is all about and just about units. **Typed quantities** should be preferred if we also +want to be **quantity-safe**. This, for example, allows us to specify if we deal with _width_, +_height_, or _radius_ and ensure we will not assign one to another by accident. The previous example can be re-typed using typed quantities in the following way: @@ -249,7 +248,7 @@ error: no viable conversion from returned value of type As we can see above, the compilation error is longer but still relatively easy to understand. -### Additional type safety with typed quantities +### Quantity-safety with typed quantities Based on the previous example, it might seem that typed quantities are not that useful, more to type and provide harder-to-understand error messages. It might be true in some cases,