Best way to structure C++ and Rust code in Rust project?

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

Usually interfacing with C/C++ is moved to a separate crate. They're called sys crates.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.