Files
Steffen Golle cdc1eccc87 Add Rust Wrapper (#1977)
* Add Rust Wrapper

Signed-off-by: Steffen Golle <somnium@stampernet.de>

* Remove Rust Wrapper

Signed-off-by: Steffen Golle <somnium@stampernet.de>

* Add Rust Wrapper as submodule

Signed-off-by: Steffen Golle <somnium@stampernet.de>

* Add Rust Wrapper as submodule

Signed-off-by: Steffen Golle <somnium@stampernet.de>

* Remove Rust wrapper submodule

* Readd Rust wrapper version 0.2.0
2021-02-27 12:08:28 -05:00
..
2021-02-27 12:08:28 -05:00
2021-02-27 12:08:28 -05:00
2021-02-27 12:08:28 -05:00
2021-02-27 12:08:28 -05:00
2021-02-27 12:08:28 -05:00
2021-02-27 12:08:28 -05:00
2021-02-27 12:08:28 -05:00

Welcome to coolprop-rs

EXPERIMENTAL CoolProp Wrapper for Rust

The wrapper uses rust-bindgen to create the bindings to the C++ shared library of CoolProp and adds some wrapper functions. The wrapper should work on all platforms that CoolProp and Rust work on.

Prerequisites

The CoolProp shared library (libCoolProp.so) and header file (CoolPropLib.h) must be installed on the computer in the systems folder. On Linux e. g. /usr/lib64 and /usr/include. Instructions to compile and install CoolProp for your system can be found on the project page of CoolProp.

Installation

The wrapper gets published on crates.io as coolplot-rs and you can add the library in your project.

[dependencies]
coolprop-rs = "0.2"

Examples

At the moment the wrapper provides access to either the full C++ bindings directly or a small subset of methods which utilizes Rust types, error handling and unit testing.

The C++ bindings can be used with:

Rust:

use coolprop-rs::bindings::*;

The subset of Rust methods are at the moment PropsSI() and HAPropsSI():

Rust:

use coolprop-rs;
println!("{:?}", coolprop-rs::PropsSI("H", "T", 300.0, "Q", 1.0, "R134a").unwrap());
println!("{:?}", coolprop-rs::HAPropsSI("H", "T", 300.0, "P", 100000.0, "R", 0.0).unwrap());

Output:

413265.6843372975
27013.112479771713

License

This Rust package is released under the terms of the MIT license.