Import modules in local crates

I'm trying to understand how to import modules. Rust By Example only covers the most common cases, and is not clear what to do in other cases - or if other cases are the results of bad design.

So, my questions are:

  • How do I import src/common/ into src/common/
  • Is it a bad idea to do so?
  • How do I import src/hello/ into src/world/
  • Is it a bad idea to do so?


mod a;
mod b;


use super::b; // relative import
use crate::common::b; // absolute import

use crate::hello::hello;

And no, neither are a bad idea.

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.