I have an exercise library to learn Rust. This library provides two kinds of methods:
- core methods which should be in a file called renderay_core.rs.
- shape methods which use the core methods to have a higher abstraction/more concrete implementation of the core methods; convenience methods for "often used" cases. These should be in a file called renderay_shapes.rs.
I also want to have unit tests in them as submodules.
I thought of something like:
- renderay.rs is the library source
[lib] path="src/renderay.rs"
- renderay_core.rs is a module which is loaded into renderay.rs as public(?) to yield its API
- renderay_shapes.rs is also a module within renderay.rs but also imports renderay_core.rs to its core API
If I load this crate as a dependency, I would like to have the API of renderay_core.rs and renderay_shapes.rs available.
I'm sure it is a trivial task, but I have a hard time getting my head around the module mechanics coming from Java and C. I already read the crates and modules documentation. How to setup such a structure and compile it successfully?