The Missing Bit

TIL - Rust crate lib and binaries are separate compile unit

Given a rust crate with three files:

When and are compiled, they are each compiled in their own independant compile unit. This means that we have to put mod common inside each file.

But the better approach is to put mod common inside and do use my_crate_name::common inside or other binaries within the crate.