I have three files:
// a.rs
struct MyThing {
}
// b.rs
mod a;
struct That {
mything: &a::MyThing;
}
// main.rs
mod a;
mod b;
fn main() {
let thing= a::MyThing{};
let that= b::That{myThing: &thing};
}
The compile error I get for a.rs is:
file not found for module
b
help: to create the moduleb
, create file "src/a/b.rs" or "src/a/b/mod.rs"
I thought I would need mod a;
so that I can access the module in a.rs
, but it looks like since mod b;
is in main.rs
, the mod a;
inside b.rs
is interpreted relative to b
...or something.
How do I use one .rs
file from another?