问题
I have a front-end project that has a lot of stuff in src
folder, and I have the opportunity to also use Rust on the server side. All my Rust server files are in the server
folder; how can I tell Cargo to run ./server/app.rs
?
回答1:
As stated in the comments, you are probably better off just moving all of your code into the "server" directory. If you don't, you are going to be swimming uphill against defaults, which is not usually a great idea.
That being said, you can specify the path to the binary or library in your Cargo.toml:
[[bin]]
name = "quux"
path = "server/main.rs"
[lib]
name = "quux"
path = "server/lib.rs"
See also:
- Rust package with both a library and a binary?
来源:https://stackoverflow.com/questions/47649318/how-do-i-tell-cargo-to-run-files-from-a-directory-other-than-src