Skip to content

Commit d1cf85c

Browse files
committed
Bumped version, updated README.md.
Example is now copy-paste executable (wish cargo test would run it though).
1 parent 5b8d747 commit d1cf85c

File tree

2 files changed

+37
-29
lines changed

2 files changed

+37
-29
lines changed

Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[package]
22
name = "measurements"
3-
version = "0.2.1"
4-
authors = ["James O'Cull <[email protected]>"]
5-
documentation = "https://jocull.github.io/rust-measurements/"
3+
version = "0.3.0"
4+
authors = ["James O'Cull <[email protected]>", "Jonathan Pallant <[email protected]"]
5+
documentation = "https://docs.rs/crate/measurements"
66
repository = "https://github.com/jocull/rust-measurements"
77
keywords = ["measurements", "lengths", "weights", "temperatures", "volumes"]
8-
description = "Handle metric, imperial, and other measurements with ease! Types: Length, Temperature, Weight, Volume"
8+
description = "Handle metric, imperial, and other measurements with ease! Types: Length, Temperature, Weight, Volume, Pressure"
99
license = "MIT"
10+
readme = "README.md"

README.md

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,51 @@ Conversions to and from different units are simple, and operator overrides allow
2222
- Temperature
2323
- Weight
2424
- Volume
25+
- Pressure
2526

2627
### Examples
2728

2829
In your Cargo.toml add the dependency...
2930

30-
```
31+
```toml
3132
[dependencies]
32-
measurements = "^0.2.1"
33+
measurements = "^0.3.0"
3334
```
3435

3536
In your code...
3637

3738
```rust
3839
extern crate measurements;
3940

40-
use measurements::{Length, Temperature, Weight, Volume};
41-
42-
// Lengths!
43-
let football_field = Length::from_yards(100.0);
44-
let meters = football_field.as_meters();
45-
println!("There are {} meters in a football field.", meters);
46-
47-
/// Temperatures!
48-
let boiling_water = Temperature::from_celsius(100.0);
49-
let fahrenheit = boiling_water.as_fahrenheit();
50-
println!("Boiling water measures at {} degrees fahrenheit.", fahrenheit);
51-
52-
// Weights!
53-
let metric_ton = Weight::from_metric_tons(1.0);
54-
let united_states_tons = metric_ton.as_short_tons();
55-
let united_states_pounds = metric_ton.as_pounds();
56-
println!("One metric ton is {} U.S. tons - that's {} pounds!", united_states_tons, united_states_pounds);
57-
58-
// Volumes!
59-
let gallon = Volume::from_gallons(1.0);
60-
let pint = Volume::from_pints(1.0);
61-
let beers = gallon / pint;
62-
println!("A gallon of beer will pour {} pints!", beers);
41+
use measurements::{Length, Pressure, Temperature, Volume, Weight};
42+
43+
fn main() {
44+
// Lengths!
45+
let football_field = Length::from_yards(100.0);
46+
let meters = football_field.as_meters();
47+
println!("There are {} meters in a football field.", meters);
48+
49+
/// Temperatures!
50+
let boiling_water = Temperature::from_celsius(100.0);
51+
let fahrenheit = boiling_water.as_fahrenheit();
52+
println!("Boiling water measures at {} degrees fahrenheit.", fahrenheit);
53+
54+
// Weights!
55+
let metric_ton = Weight::from_metric_tons(1.0);
56+
let united_states_tons = metric_ton.as_short_tons();
57+
let united_states_pounds = metric_ton.as_pounds();
58+
println!("One metric ton is {} U.S. tons - that's {} pounds!", united_states_tons, united_states_pounds);
59+
60+
// Volumes!
61+
let gallon = Volume::from_gallons(1.0);
62+
let pint = Volume::from_pints(1.0);
63+
let beers = gallon / pint;
64+
println!("A gallon of beer will pour {:.1} pints!", beers);
65+
66+
// Pressures!
67+
let atmosphere = Pressure::from_atmospheres(1.0);
68+
println!("Earth's atmosphere is usually {} psi", atmosphere.as_psi());
69+
}
6370
```
6471

6572
--------------------------------------

0 commit comments

Comments
 (0)