2019-02-06 08:17:16 -05:00
|
|
|
# Embedded Unit Converter
|
2019-02-01 08:41:54 -05:00
|
|
|
|
2019-02-04 08:47:29 -05:00
|
|
|
Embed a small bit of code that converts between units of measure, e.g. Fahrenheit to Celsius.
|
2019-02-01 08:41:54 -05:00
|
|
|
|
|
|
|
An example of a Rust library that is embeddable in Python and Web Assembly.
|
|
|
|
|
|
|
|
## Getting setup
|
|
|
|
|
|
|
|
Insure the following dependencies are in place:
|
|
|
|
|
2019-02-06 08:57:13 -05:00
|
|
|
* Rust v1.32+ (nightly)
|
|
|
|
* Install using `rustup toolchain install nightly`
|
|
|
|
* Set default toolchain `rustup default nightly`
|
2019-02-01 08:41:54 -05:00
|
|
|
* Python 3 Development headers (python3-dev in Ubuntu)
|
|
|
|
|
2019-02-06 08:57:13 -05:00
|
|
|
## Running the Python example
|
|
|
|
|
|
|
|
1. Build the rust crate first: `cargo build`
|
|
|
|
|
2019-02-01 08:41:54 -05:00
|
|
|
## Documentation
|
|
|
|
|
|
|
|
* [PyO3 Python - Rust bindings](https://pyo3.rs/master/get_started.html)
|
|
|
|
* [Setting up WebAssembly](https://www.hellorust.com/setup/wasm-target/)
|
|
|
|
* [Rust WASM book](https://rustwasm.github.io/book/introduction.html)
|