0

For example, I have ./main.rs and 2 dirs "a", "b". At ./a/x.rs I need to call function from ./b/y.rs.

I try to add "mod b;" at the top of ./a/x.rs but get a compilation error.

How can I include module from the same dir level?

user1312837
  • 1,268
  • 1
  • 11
  • 29
  • 1
    Have you read [the crate and module](https://doc.rust-lang.org/book/crates-and-modules.html) section of the book? It's a good starting point. – Matthieu M. Feb 10 '17 at 08:11
  • The short answer: `use` was designed so that you can generally move your modules around without having to change the imports. By default, it resolves all names from the *root*. To change the default, you can use `use self::` to start from the current module or `use super::` to start from the parent module (and you use `use super::super::` to get to the grand-parent module). – Matthieu M. Feb 10 '17 at 08:15

0 Answers0