Provide Amount & co in no-alloc#2408
Conversation
Using the crate without allocation was previously disabled making the crate empty without the feature. This chage makes it more fine-grained: it only disables string and float conversions which use allocator. We could later provide float conversions by using a sufficiently-long `ArrayString`.
Pull Request Test Coverage Report for Build 7678592996
💛 - Coveralls |
Previously the crate used negative reasoning to enable `std` which was hard to understand, required the `prelude` module and wasn't really needed because it's only needed when a crate wants to add `alloc` feature-backwards compatibly and this crate always had the feature. This cleans up usage to unconditionally use `#[no_std]` and then just add `extern crate` on top as needed by activated features.
4565fa3 to
ac26171
Compare
|
Fun! I also learned this trick recently (maybe from a cargo-semver-checks blog post). The use of |
That's definitely where I found it.
Without it each crate has an implicit Personally I find it easier to reason about additive features. When something requires feature |
Usually it's called |
Well, by definition we can rename it without breaking the API so I'm not gonna hold up this PR over it :). But if in the future somebody suggests a clearly-better or well-established name we should move to it. |
Using the crate without allocation was previously disabled making the
crate empty without the feature. This chage makes it more fine-grained:
it only disables string and float conversions which use allocator. We
could later provide float conversions by using a sufficiently-long
ArrayString.Note that this is API-breaking because we disallow calling the methods of the sealed
SerdeAmounttrait. However I think it should've been obvious that the thing is internal and calling them is not a great idea. (BTW I only learned this trick recently).Closes #2389