Multiple files in Rust?
How can I have multiple files in Rust compile down to a single executable?
My project structure looks like this:
Cargo.toml src/ main.rs error.rs front.rs
Cargo.toml looks like this:
[package] name = "mirror" version = "0.0.1" authors = ["DynamicSquid"] edition = "2018" [dependencies] [lib] name = "error" path = "src/error.rs"
And it works fine with just the
error files, but I can't seem to get it to work with 3 or more files.
I don't think I'm understanding Rust's Cargo system correctly.
I was thinking of using the
include! macro, but I heard it was bad practice.
Would you be willing to help me @Jakman?
first off, you don't need to change the cargo.toml file, that's nasty.
Second off, have you seen the rust tutorial?