pubgrub-rs / pubgrub

PubGrub version solving algorithm implemented in Rust
https://pubgrub-rs.github.io/pubgrub/pubgrub/
Mozilla Public License 2.0
337 stars 29 forks source link

The pubgrub api should be one top level module #230

Open konstin opened 3 weeks ago

konstin commented 3 weeks ago

Currently, pubgrub's public api consist of a number of modules, each containing one to few symbols. Instead, all exported symbols should be in the top level module, and the module level documentation should move onto the appropriate type. Only type_aliases and report may remain their only modules. This simplifies the api and makes it easier to discover.

Eh2406 commented 3 weeks ago

cc https://github.com/pubgrub-rs/pubgrub/issues/114

mpizenberg commented 3 weeks ago

That’s probably my fault. I wrote the initial module as if I was writing an Elm project. One module centered around one data structure. It’s one granularity I found to be easy to work with when we need to have private/public modules well separated while preventing cyclic dependencies. Elm throws a compiler error when there is a cyclic import. I realized it helped me write more modular code in rust too, so even when the rust compiler isn’t as strict, I’m still following this habit.

I’m also fine with every public thing under the same module, especially for package users. If you can figure out a way to have this, while still preventing cyclic imports with private modules, I think I could be in favor of that.