Building a Rust interface with the pyO3 crate
Building an interface does not just mean adding more functions to our module in Rust and wrapping them. In a sense, we do have to do some of this; however, exploring how to import them from other Rust files is important. We also must explore and understand the relationship that we can have between Rust and Python when we are building up our module. To achieve this, we will carry out these steps:
- Build our Fibonacci module in our Rust package.
- Create command-line tools for our package.
- Create adapters for our package.
With step one, we can just build out our module with Rust code. Steps two and three are more Python-focused, wrapping our Rust code in Python code to ease the interaction of our Rust module with external Python code. In Chapter 6, Working with Python Objects in Rust, we will interact directly with Python objects in our Rust code. With all this in mind, let's our Python interface by initially building...