A simple Cargo project has this structure:
project/Cargo.toml
project/src
project/src/lib.rs
project/src/main.rs
Suppose that I want to use a library, and for that lbrary I must create a C interface for Rust to call, and a Rust interface for Rust to use, so I add interface.h
and interface.rs
and also I have the directory of the C++ library mylib
, so I end up with
project/Cargo.toml
project/src
project/src/main.rs
project/src/lib.rs
project/src/interface.rs
project/src/interface.h
project/mylib
this is the way I currently tend to structure my Rust projects that have a C++ library dependency and need a C interface to be used from Rust.
Is this a good way to structure or there is a better way in Rust? I don't like to ignore standards