Make serde
, toml
deps optional
#310
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We make
serde
andtoml
dependencies optional, enabled by default, using default features.Config1 already allows to configure it programmatically, using the
set_xxx
methods. However, refinery-core (used by refinery crate) uses serde by default to support serialization and deserialization of this type. This is unnecessary if one doesn't need therefinery-cli
and also configures it programmatically.On top of that, refinery makes the assumption that
Toml
format will be used to deserialize/serialize this type, as toml dependency is used as well in refinery-core by default. Again it's not always the case, this is more related withrefinery-cli
.Let's declare both
serde
andtoml
dependencies as optional, under a feature flag. Apparently, iftoml
dependency is enabled,serde
should be enabled as well, thustoml
feature enablesserde
feature automatically.For
refinery-cli
, we just make sure to enabletoml
(and consequentlyserde
) feature when using therefinery
dependency, since it's impossible forefinery-cli
to work without these 2 dependencies.However, for
refinery
, we declare them under the default features: they will be enabled by default, unless the host crate specifiesdefault-features = false
.Fixes #308.
Footnotes
https://docs.rs/refinery/latest/refinery/config/struct.Config.html ↩