E0432 no `read_csv` in the root

in this example, there are at least 3 different crates in the same package:

  • a binary crate gui, root module is source file src/bin/gui.rs
  • a binary crate jonathan (same as the package name), root module is src/main.rs
  • a library crate jonathan (same as the package name), root module is src/lib.rs

when you use crate::read_csv in each crate, the crate keyword refers to the root module of its own crate, so it will only work in main.rs where you have declared the module with mod read_csv;

when you write jonathan::read_csv, jonathan refers to the library crate. this can be resolved correctly if you have pub mod read_cvs; in lib.rs. it will NOT work with an empty lib.rs

see also my previous answer on these terms and concepts: Is a static in lib.rs unresolvable - #9 by nerditation