Fixed error in main example usage

This commit is contained in:
Kasper 2020-08-20 22:10:07 +02:00
parent 9ae7047930
commit 9cbf5cbb83
2 changed files with 6 additions and 4 deletions

View File

@ -198,6 +198,7 @@ The compiled binaries will now be available inside `target/<target>/release/`. T
1. Update `CHANGELOG.md` 1. Update `CHANGELOG.md`
2. Bump the version number in `Cargo.toml` and run `cargo check` 2. Bump the version number in `Cargo.toml` and run `cargo check`
3. Run `cargo test`
3. Cross-compile cpc by following [the steps above](#cross-compiling) 3. Cross-compile cpc by following [the steps above](#cross-compiling)
4. Commit and tag in format `v1.0.0` 4. Commit and tag in format `v1.0.0`
5. Publish on crates.io: 5. Publish on crates.io:

View File

@ -8,15 +8,16 @@
//! //!
//! # Example usage //! # Example usage
//! ```rust //! ```rust
//! use cpc::{eval, Unit::*} //! use cpc::{eval};
//! use cpc::units::Unit;
//! //!
//! match eval("3m + 1cm", true, Celcius) { //! match eval("3m + 1cm", true, Unit::Celcius, false) {
//! Ok(answer) => { //! Ok(answer) => {
//! // answer: Number { value: 301, unit: Unit::cm } //! // answer: Number { value: 301, unit: Unit::Centimeter }
//! println!("Evaluated value: {} {:?}", answer.value, answer.unit) //! println!("Evaluated value: {} {:?}", answer.value, answer.unit)
//! }, //! },
//! Err(e) => { //! Err(e) => {
//! println!(e) //! println!("{}", e)
//! } //! }
//! } //! }
//! ``` //! ```