Once again I find myself fighting for an hour to get 4 source files in the same src directory to build.
I've read the book, seen the movie, read questions and responses here. I conclude there is something deep going on that I just don't understand yet.
I have 4 source files: main.rs, tatami.rs, primes.rs and constants.rs.
main.rs uses tatami.rs and primes.rs.
tatami.rs uses primes.rs
primes.rs uses nothing.
I'll come to constants.rs later.
After a prolonged discussion with the compiler I end up with a build by having this at the top of main.rs:
mod primes;
use primes::Primes;
mod tatami;
use tatami::Tatami;
But to use primes from tatami I have to have this at the top of tatami.rs:
use crate::primes::Primes;
Why is this different ? What am I missing? Am I just trying to do things the wrong way?
Along the way, compiler error messages kept suggesting I introduce directories for tatami and primes and name all the sources "mod.rs". What is that about? I really don't want all my editor tabs to show the same filename everywhere.
Meanwhile my constants.rs contains only:
pub const PNUM: usize = 1300;
pub const FNUM: usize = 10;
pub const SMAX: i32 = 100_000_000;
So far I have failed get the compiler to tell me any way to use those constants from all my other files (I have duplicated them locally to get the thing to build!)
What to do?