-
Notifications
You must be signed in to change notification settings - Fork 627
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ac26171 maaybe private
should be renamed to internal_api
or something
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ac26171
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
SerdeAmount
trait. 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