For context, I currently have a number of crates that make up the iocaine project:
iocaine-recipe is the configuration loader, config structures, and KDL helpers.iocaine-powder are the matchers, generators, and the scripting engines. It sits atop iocaine-recipe.iocaine-vial contains the various servers (http-server, haproxy-spoa-server, and soon, prometheus-server), along with implementing iocaine-powder's HTTP type traits for http::Request and http::Response. It sits atop iocaine-powderiocaine-challenge implements the various command-line command handlers: this has an implementation for iocaine start, iocaine validate-configuration, iocaine runtime decide, iocaine runtime output, and iocaine self-test. It sits atop iocaine-vial.iocaine-table is the firewall implementation, and is currently unused. It will be used by the script engine implementations.iocaine the main CLI crate, a thin wrapper around iocaine-challenge.
Now, I have a problem. I have another project - a spam filter - that could use the same matchers I have implemented for iocaine. There's absolutely no point in reimplementing them again. Technically, I could pull in iocaine-powder, with default features disabled, and only the matchers enabled, and that'd do the trick, but then I'd have access to the matchers, but not to their roto bindings (my spam filter uses Roto too).
So I'm thinking about how to handle the situation. I can either restructure iocaine-powder, and move the roto/lua bindings out of the script engine implementation, so I can do features = ["all-matchers", "language-roto"] and have access to both the types and their roto bindings.
Or, I can move those to a whole separate crate, so that iocaine-powder has the engine trait & impl, but another crate has the matchers, perhaps another the generators, with roto & lua bindings in their matcher/generator crates.
Keeping it all in one crate means it's all neatly in one place. Splitting it up means that third parties that only need parts of it have less dependencies to deal with (I mean, they end up with the same practical dependencies, as the unnecessary ones can be disabled via cargo features - but they'll still be there as "optional" deps).
So now I'm wondering what to do. Do I split the crate? If so, how granular do I go? Do I split matchers and generators into their separate crates? Or do I split matchers + generators in one crate, and keep the script engine stuff in iocaine-powder?
And if I split, what even is the point of iocaine-powder? It'd be a very thin layer over the SexDungeon trait (declared within the very same crate) that binds that, the recipes, and the matchers / generators together, along with some very iocaine specific stuff that doesn't fit elsewhere.
Decisions, decisions.
I do need to rearrange the powder crate, though, so I can have
--no-default-features -F all-matchers -F language-roto, and end up with a useful result.That is, I don't want to enable
-F http-servertoo. I don't want theSexDungeontrait and its stuff.