News for hackers. Stuff that matters.
Re:Rust Dependencies Scare Me by kion on Friday May 09, 2025 @05:27PM (#43941047)
I probably mischaracterized this as its been a while since I did more than trivial Rust. AFAIK its not possible to depend on only a part of a module in Rust though right? (At least without an external build system)

For example, you can't split up a module into foo.rs containing `Foo` and bar.rs containing `Bar`, both in module 'mymod' in such a way that you can `use mymod::Bar and foo.rs is never built/linked.

My point is the granularity of the package/mod encourages course-grained deps, which I argue is a problem.

Re:Rust Dependencies Scare Me by dathinab on Friday May 09, 2025 @06:28PM (#43941523)
> not possible to depend on only a part of a module in Rust though right

yesn't, you can use feature flags similar to `#if` in C

but it's also not really a needed feature as dead code elimination will prune out all code functions, types, etc. you don't use. Non of it will end up in the produced binary.

Re:Rust Dependencies Scare Me by eddd-ddde on Friday May 09, 2025 @05:45PM (#43941191)
You'd use feature flags to enable certain parts of the library.