-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make all dependencies optional #100
Conversation
A potential source of breakage here is if folks are currently using |
Possibly also worth noting that libraries using |
cc @briansmith This makes a pretty big impact on compile-times. On my machine locally for release builds I'm waiting ~18s with default features, and ~1.5s without them. Artifact size is also a bit smaller. I'll do a proper review of the APIs that are available and unavailable depending on features, but this seems worth following through for folks that care about compile times and don't care about the format. What do you think? |
Thank you for this. The community needs more of these PRs. (Thanks to the library author too) |
I did a quick run through source on GitHub and came up with a few dependencies that would see a change in their default format following this PR:
I'm starting to lean towards pushing this and #82 together as a minor version bump, so |
I've added a simple test harness as a local crate that runs tests for all feature permutations. The number of permutations will increase exponentially with the number of optional features so in the future we might need a different strategy for maintaining confidence that everything plays nicely. |
…o feat/optional-dependencies
Except for
log
.Closes #71
Closes #72
This PR refactors the internals of the
fmt
module so we can optionally exclude dependencies and their supported features. The goal of making things optional is to improve compile times and reduce artifact sizes so rather than trying to shim the same public API we exclude swathes of API that are tied to specific dependencies when those dependencies aren't available.By default all current dependencies are included. Since
env_logger
usually lives at the top of a dependency graph, if an application disables default features then it should be unlikely that another dependency adds them back in.This is still in a bit of a strawman phase, there might be other approaches we'll want to consider.