Conversation
Lotterleben
approved these changes
Dec 18, 2020
|
|
||
| #[test] | ||
| fn ty() { | ||
| fn all_types() { |
| let g = Formatter { inner: f }; | ||
|
|
||
| write!(g, "bitfields {0:0..7} {0:9..14}", 0b0110_0011_1101_0010u16); | ||
| write!(g, "bitfields {0=0..7} {0=9..14}", 0b0110_0011_1101_0010u16); |
Contributor
There was a problem hiding this comment.
add qemu tests for bitfields + display hints combinations
this function parses a single format parameter
to use the new syntax
this function parses a complete format string
to use the new syntax
also fix parsing of array types ("=[u8; 3]")
"{}" and "{0}" are now valid format strings
to use the new syntax
to use the new syntax
to use the new syntax
to use the new syntax
and apply display hints to byte slices / arrays
for strings
this mode rejects unknown display hints use strict mode when parsing strings used in the write! and logging macros do not use the strict mode when decoding defmt data in e.g. probe-run
the signature of `parse` and `parse_param` changed
a708aae to
ecd9800
Compare
Lotterleben
approved these changes
Dec 18, 2020
Closed
Member
Author
|
bors r+ |
Contributor
|
Build succeeded: |
| ``` rust | ||
| # extern crate defmt; | ||
| defmt::info!("x={:?}", foo()); | ||
| defmt::info!("x={=?}", foo()); |
Contributor
There was a problem hiding this comment.
Hmm, ? is a display hint, so why does =? also work here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
breaking-change this changes the format string syntax as specified in RFC #270
Display hints that have been implemented:
:b), e.g.0b1010:X), e.g.0xA0:x), e.g.0xa0:a), e.g.b"he\xffllo(works on byte slices[u8]):?), e.g."Hello"(works on strings)TODO
FIXME
derive(Format)on structs that contains string fields formats those fields "Display"-style (w/o double quotes)(may not be necessary to block this PR on that fix though)