Keeping our Rust implementation simple by piping data to and from Rust
We have covered everything we need to integrate Rust into our Python system. We can build Rust packages that can be installed using pip
and use them in Docker when integrating with a web application. However, reaching for a setup tool can be too much effort if the problem being solved is small and simple. For instance, if in a situation we were merely opening a comma-separated values (CSV) file full of numbers in Python, calculating the Fibonacci numbers, and then writing them in another file, then it would make sense to just write the program in Rust. However, we do not start building a Rust package with Python setup tools if we have a more complicated Python standalone script that just needs a simple speedup with Rust—it is still just a standalone script. Instead, we pipe data. This means we pass data from a Python script to a Rust standalone binary and back to a Python script for computing Fibonacci numbers...