December 8, 2022, 9:12pm
I've got a project which is organized as follows:
pub mod a;
pub mod b;
Now I have a function in file a.rs. I want to use it in file b.rs. How can I do this?
You should be able to reference public items in module
crate::common::a::whatever (from anywhere in the tests, as long as the test file includes the
December 8, 2022, 9:36pm
I've tried super. But I get:
Could not find 'a' in 'super'
I've also tried crate. But I get:
Could not find 'a' in 'common'
I confirmed that it worked for me on rustc 1.65.0. The only way I can replicate that error is if I remove the
mod a; from the
March 8, 2023, 9:54pm
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.