3
12bitfloat
126d

Holy shit I don't understand Rust's module system. Package I have not a single clue what it is... It "can contain one library crate and multiple binary crates". What? Okay so a crate is a collection of modules. Great, now how do you define modules? `mod whatever {}` probably. Then what the hell does `mod whatever;` do?? Import a module from a file with the same name (ignoring the fact that modules and files don't seem to have anything to do with each other). But why `mod` to import? How does that differ from `use`-ing a module? What is any of this??

Comments
  • 1
    Heheh sounds it has been fun so far x'D. Hmm never wrote Rust. But on first look it seems mod is import and use is namespace (as in using C++ namespace).

    Let's see how internet works on this one.
  • 1
    @Pyjong I guess I've figured it out. Files and modules have basically nothing to do with eachother except for special files: main.rs, lib.rs and mod.rs. Naked "mod" is needed to declare that other source files even exist. "Use" is used to... well import modules from the virtual module tree, which is filled via "mod"-blocks from any source file
  • 2
    @Pyjong Actually, scrap everything I've just said
Add Comment