3 ms·
I have the same problem with Rust modules: e.g., where do I put crate::, vs module X, vs module X{ } again? Do I have to specify it in the automatic lib.rs too
by jvanderbot 3y ago
I have the same problem with Rust modules:
e.g., where do I put crate::, vs module X, vs module X{ } again? Do I have to specify it in the automatic lib.rs too? Or ...
C at least lives on the filesystem and you tell it where to grab things.
- treyd 3y agoModule definitions in Rust have simple rules that resolve `mod foo;` into foo.rs or foo/mod.rs, which lives in the filesystem layout just as it does in C, you just don't have to use quotes and it has to form a tree from a root module at lib.rs. If you want to be even more explicit about it there's an attribute you can put on a `mod` item to override the normal path resolution rules.
- kerkeslager 3y ago> e.g., where do I put crate::, vs module X, vs module X{ } again? Do I have to specify it in the automatic lib.rs too? Sure, but there's one clear answer to that question which you can refresh your memory of in under 3 minutes of reading. C does live in the filesystem, but where in the filesystem? Oh and it doesn't always live in the filesystem--sometimes it lives in the package system.