Splitting out common code into separate crates

I have two crates that need to share some common functions (the functions are not related to each other). Is it considered more idiomatic to put all the common code in one big crate (which then contains a mixed bag of unrelated functions), or create a separate crate for every domain? Note that I doubt this common code would be useful for anyone else, so publishing it on crates.io is not a consideration.

It is useful to split out common code into a dependency. This is because dependencies are not recompiled unless they've been altered. So compared to 1 monolithic project it may save you some compile time.

Note that I've published crates that I don't will be used by anyone else to crates.io. It's a convenient distribution platform, so I wouldn't let the number of expected users stop you.

Also note that Linux started as a project of which Linus expected that it wouldn't be useful to anyone. You never know where it'll go.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.