Skip to content

Commit

Permalink
minor formatting tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tehforsch committed Feb 25, 2024
1 parent a6da0c1 commit f2ead9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ This is why the `Product` and `Quotient` types are provided:
```rust
use diman::si::dimensions::{Length, Time};
use diman::{Product, Quotient};

fn foo(l: Length<f64>, t: Time<f64>) -> Product<Length<f64>, Time<f64>> {
l * t
}
Expand All @@ -258,8 +259,12 @@ fn bar(l: Length<f64>, t: Time<f64>) -> Quotient<Length<f64>, Time<f64>> {
# Rational dimensions
The `rational-dimensions` feature allows using quantities with rational exponents in their base dimensions, as opposed to just integer values. This allows expressing defining dimensions and units such as:
```rust
unit_system!(
// ...
dimension Sorptivity = Length Time^(-1/2);
unit meters_per_sqrt_second: Sorptivity = meters / seconds^(1/2);
// ...
);
let l = 2.0 * micrometers;
let t = 5.0 * milliseconds;
let sorptivity: Sorptivity = l / t.sqrt();
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
//! ```
//! use diman::si::dimensions::{Length, Time};
//! use diman::{Product, Quotient};
//!
//! fn foo(l: Length<f64>, t: Time<f64>) -> Product<Length<f64>, Time<f64>> {
//! l * t
//! }
Expand All @@ -326,7 +327,7 @@
//! ```ignore
//! # mod surround {
//! # use diman_unit_system::unit_system;
//! # unit_system!(
//! unit_system!(
//! # quantity_type Quantity;
//! # dimension_type Dimension;
//! # dimension Length;
Expand All @@ -337,9 +338,11 @@
//! # #[base(Time)]
//! # #[symbol(s)]
//! # unit seconds;
//! // ...
//! dimension Sorptivity = Length Time^(-1/2);
//! unit meters_per_sqrt_second: Sorptivity = meters / seconds^(1/2);
//! # );
//! // ...
//! );
//! # }
//! # use surround::dimensions::Sorptivity;
//! # use surround::units::{micrometers,milliseconds};
Expand Down

0 comments on commit f2ead9c

Please sign in to comment.