[英]Does Rust allow lib/mod.rs in place of lib.rs?
Considering I have lib.rs
and main.rs
:考虑到我有
lib.rs
和main.rs
:
is it possible to create a lib/
folder, to hold and separate the subfolders from src/
,是否可以创建一个
lib/
文件夹,以保存子文件夹并将其与src/
分开,
and use lib/
+ lib.rs
or lib/mod.rs
to reference the submodules?并使用
lib/
+ lib.rs
或lib/mod.rs
来引用子模块?
Library main file can be placed anywhere and have an arbitrary name, there's a cargo config section for that:库主文件可以放在任何地方并具有任意名称,有一个货物配置部分:
[lib]
path = "src/lib/mod.rs" # by default it is src/lib.rs
However, I would suggest to look at workspaces , it might be a better fit for you.但是,我建议您查看workspaces ,它可能更适合您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.