这可能是个愚蠢的问题,但我似乎解决不了它。
我有这样一种文件结构:
在
我有这样一种文件结构:
└── src
├── another.rs
├── some_file.rs
└── main.rs
在
some_file.rs
中,我想要调用main.rs
中的一个函数。因此,我在some_file.rs
中尝试做这样的事情:use crate::main
fn some_func() {
// other code
main::another_func_in_main();
}
但是编译器会抛出一个错误:
use of an undeclared crate or module `main`
我该如何解决这个问题?
use crate::another_func_in_main
。 - Martin Gallaghercrate::another_func_in_main();
。 - Holloway