Implement no_std
support with simplified to_string
#33
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.
My attempt at resolving #3.
Some things had to change. Firstly, in order to support alignment format specifiers we would have to write to a buffer and then
Formatter::pad
that. So we do not support alignment inno_std
. I can add that if that is a requirement, but I felt that implementing the buffer would be a lot.Also, the algorithm used to select the correct units had to change.
no_std
does not have access to complex math likeln
. So we just manually check which unit is correct and go from there.Nothing should be changed when
std
is enabled. These things are conditionally changed when thestd
feature is disabled.If you test with
cargo test --no-default-features
it will run all the tests that can be run withno_std
.Oh! Also I put aside the parsing element. None of that is enabled when not using the standard library.