Skip to content

Commit

Permalink
minor fixes in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Tehforsch committed Feb 25, 2024
1 parent b474fe0 commit c6dcc25
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ let ratio_deref: f64 = *(l1 / l2);
assert_eq!(ratio_value, ratio_deref);
```
## Unchecked creation and conversion
If absolutely required, `.value_unchecked()` provides access to the underlying storage type for all quantities. This is not unit-safe since the return value will depend on the unit system!
If absolutely required, `.value_unchecked()` provides access to the underlying storage type for all quantities. This is **not unit-safe** since the return value will depend on the unit system!
```rust
let length: Length<f64> = 5.0 * kilometers;
let value: f64 = length.value_unchecked();
assert_eq!(value, 5000.0); // This only holds in SI units!
```
Similarly, if absolutely required, new quantities can be constructed from storage types using `Quantity::new_unchecked`. This operation is also not unit-safe!
Similarly, if absolutely required, new quantities can be constructed from storage types using `Quantity::new_unchecked`. This operation is also **not unit-safe**!
```rust
let length: Length<f64> = Length::new_unchecked(5000.0);
assert_eq!(length, 5.0 * kilometers); // This only holds in SI units!
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
//! assert_eq!(ratio_value, ratio_deref);
//! ```
//! ## Unchecked creation and conversion
//! If absolutely required, `.value_unchecked()` provides access to the underlying storage type for all quantities. This is not unit-safe since the return value will depend on the unit system!
//! If absolutely required, `.value_unchecked()` provides access to the underlying storage type for all quantities. This is **not unit-safe** since the return value will depend on the unit system!
//! ```
//! # #![feature(generic_const_exprs)]
//! # use diman::si::dimensions::{Length};
Expand All @@ -168,7 +168,7 @@
//! let value: f64 = length.value_unchecked();
//! assert_eq!(value, 5000.0); // This only holds in SI units!
//! ```
//! Similarly, if absolutely required, new quantities can be constructed from storage types using `Quantity::new_unchecked`. This operation is also not unit-safe!
//! Similarly, if absolutely required, new quantities can be constructed from storage types using `Quantity::new_unchecked`. This operation is also **not unit-safe**!
//! ```
//! # #![feature(generic_const_exprs)]
//! # use diman::si::dimensions::{Length};
Expand Down

0 comments on commit c6dcc25

Please sign in to comment.