Hacker News new | ask | show | jobs
by Thaxll 455 days ago
Is it standard to have 2k+ loc in a lib.rs file? I'm looking at Rust code and it seems that everything goes in there. People usually don't break that down?
2 comments

I used to think big files were a problem but I've come to like them more as the years go by. I don't have to wrap my head around some organization scheme which might be half baked - it's all right there.
In general, a problem with big files is encapsulation -- ideally you want private fields to have as little visibility to other code as possible.
Agreed but this really depends on what tools the language gives you for modules. Some languages have the module structure directly coupled to the file layout like JavaScript, where others are a lot more flexible.
Nah, I think your intuition is correct it should be broken up.