Rust’s way of importing from other modules is bizarre
I come from a background of Pascal and Delphi. From about 1989 Turbo Pascal 4 and subsequently Delphi had a really useful unit system for breaking a program down into multiple source files. A unit is the equivalent of Rust’s mod. Anything you wish to export from a unit is put in the interface section of the source file- consts, types, functions etc. Like making them pub in Rust. Then in the source file that wants to use these, you just put using name-of-unit. No hassles, very easy to use and it just works.
Now in Rust, they have a cockermanie system. I had a main.rs that had several Structs (Card and Game) and decided to put it in another file poker.rs inside a mod poker {.
I made both Structs pub. When compiling, there’s no errors in poker.rs but in the main.rs which has
pub mod poker;
use poker::{Card, Game};
There’s red lines under Card and Game.
note: struct `crate::poker::poker::Card` exists but is inaccessible etc. Grrr.
Now, no doubt there is soime way to make this work but why make it so difficult?