It would be nice, if you could add a feature (or make it the default?) that replaces Vec with SmallVec and String with SmolStr. SmallVec should always be used with the most suitable stack capacity to avoid heap allocations in common cases (probably 3 in your Chunks type, e.g.).
This would then allow to add const fns to create new instances (requiring the smallvec crate's const_new feature):
if config.last_app_version < *APP_VERSION {
// Catch up.
if config.last_app_version < Version::from_major_minor_patch(1, 0, 5) {
// User agreement was changed in v1.0.5.
config.user_agreement_accepted = false;
}
if config.last_app_version < Version::from_major_minor_patch(1, 2, 0) {
config.something_else = true;
}
// To be extended with even more version comparisons, as time goes on.
}
Your serde feature must carry forward to the newly used crates (same feature name).
It would be nice, if you could add a feature (or make it the default?) that replaces
Vec
withSmallVec
andString
withSmolStr
.SmallVec
should always be used with the most suitable stack capacity to avoid heap allocations in common cases (probably 3 in yourChunks
type, e.g.).This would then allow to add
const fn
s to create new instances (requiring thesmallvec
crate'sconst_new
feature):Your
serde
feature must carry forward to the newly used crates (same feature name).