Crates with excluded proprietary parts
⚓ Rust 📅 2026-04-17 👤 surdeus 👁️ 2I was asked if I want to port an old C library to Rust, and while niche it seems like a pretty cool library to have (in case anyone is dabbling with mixmaster/mixminion type networks in Rust). However, the C version has a feature (involving forward error correction) that the client is a little unsure about with regards to ownership and patents. (Because of how old this library is, it makes me suspect there are no patent issues, but that's beside the point).
I asked if I could make the library open source, and they are fine with it as long as the fec support is left out.
Let's say I would ideally like to not have two different repos/projects for this, what mechanisms does rust/cargo have to help allow more code in the repo than in the published crate?
My spitball idea is to have build.rs check for the existence of src/fec.rs and set a cfg parameter if it finds it, and add the src/fec.rs to the exclude list in Cargo.toml.
Anyone know if there are any crates that do anything like this that one can take inspiration from?
I may end up setting up two different repositories, just to lessen the risk of accidental publishing of the fec parts. But I'm curious to know how this could be accomplished with a single repo and how safe from accidental-publishing-of-the-proprietary-parts one can make it.
3 posts - 3 participants
🏷️ Rust_feed