为什么为子模块“找不到模块文件”

时间:2019-06-28 15:42:16

标签: rust

Rust的完整新手。 具有C#背景,如果在回答问题时有帮助的话。

我有两个模块(在各自的文件中)都尝试使用第三个模块,但是只有一个模块找到了第三个模块。

为什么if(isset($_POST['test'])){ $html = <<<DOC <input type="text" id="id_management_date"/> <input type="text" id="id_management_date_format"/> DOC; echo $html; } 中mod语句的顺序很重要? 如果我删除所有的“ bar-stuff”,那么问题仍然存在……

main.rs

main.rs

mod foo; mod bar; fn main() { foo::do_foo(); bar::do_bar(); }

foo.rs

mod foo_bar; //error will be here when "mod foo;" is first in main.rs pub fn do_foo(){ println!("foo::"); foo_bar::do_foo_bar(); }

bar.rs

mod foo_bar; //error will move to here when putting "mod bar;" first in main.rs instead pub fn do_bar(){ println!("bar::"); foo_bar::do_fo_bar(); }

foo_bar.rs

0 个答案:

没有答案