Re:How to Structure C Projects: These Best Practices Worked ...
by treyd on Friday March 08, 2024 @02:08PM
(#39644868)
Module 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.
Re:How to Structure C Projects: These Best Practices Worked ...
by kerkeslager on Friday March 08, 2024 @03:33PM
(#39646068)
> 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.
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.