我有文件结构:engine 和 utils 文件夹在同一级别。引擎包含世界文件夹(其中包含 mod.rs 和 map.rs)和 mod.rs。Utils 包含 mod.rs 和 reader.rs。
我正在尝试从阅读器访问地图,但无法使“使用”语句起作用。
实用程序/mod.rs
pub mod reader;
引擎/mod.rs
pub mod world;
世界/mod.rs
pub mod map;
pub struct World;
我收到此错误:
error[E0433]: failed to resolve. Maybe a missing `extern crate engine;`?
--> src\utils\reader.rs:5:5
|
5 | use engine::world::map;
| ^^^^^^ Maybe a missing `extern crate engine;`?
你不能在子目录中声明模块,还是我错过了一些愚蠢的东西?我已经搞砸了大约半个小时的使用语句,但无法让它工作。