Skip to content

Commit

Permalink
Merge branch 'main' into octal
Browse files Browse the repository at this point in the history
  • Loading branch information
Urhengulas authored Jul 29, 2024
2 parents 6fc3f09 + 6f19880 commit 7e99b89
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

- [#859]: `defmt`: Satisfy clippy
- [#858]: `defmt`: Implement "passthrough" trait impls for *2Format wrappers
- [#857]: Add an octal display hint (`:o`)
- [#855]: `defmt-print`: Now uses tokio to make tcp and stdin reads async (in preparation for a `watch elf` flag)
- [#852]: `CI`: Update mdbook to v0.4.40
- [#847]: `decoder`: Fix log format width specifier not working as expected
- [#845]: `decoder`: fix println!() records being printed with formatting
- [#843]: `defmt`: Sort IDs of log msgs by severity to allow runtime filtering by severity
- [#822]: `CI`: Run `cargo semver-checks` on every PR
- [#855]: `defmt-print`: Now uses tokio to make tcp and stdin reads async (in preparation for a `watch elf` flag)
- [#857]: Add an octal display hint (`:o`)

[#859]: https://github.com/knurling-rs/defmt/pull/859
[#858]: https://github.com/knurling-rs/defmt/pull/858
[#857]: https://github.com/knurling-rs/defmt/pull/857
[#855]: https://github.com/knurling-rs/defmt/pull/855
[#852]: https://github.com/knurling-rs/defmt/pull/852
[#847]: https://github.com/knurling-rs/defmt/pull/847
[#845]: https://github.com/knurling-rs/defmt/pull/845
[#843]: https://github.com/knurling-rs/defmt/pull/843
[#822]: https://github.com/knurling-rs/defmt/pull/822
[#855]: https://github.com/knurling-rs/defmt/pull/855
[#857]: https://github.com/knurling-rs/defmt/pull/856

## [v0.3.8] - 2024-05-17

Expand Down
14 changes: 7 additions & 7 deletions defmt/src/encoding/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ mod inner;
/// Encodings may perform two functions:
///
/// - Framing: Adds extra data to allow the encoder to know when each frame starts
/// and ends in the stream. Unframed log frames already contain enough information for
/// the decoder to know when they end, so framing is optional. However, without framing
/// the decoder must receive all bytes intact or it may "lose sync". With framing, it can
/// recover from missing/corrupted data, and can start decoding from the "middle" of an
/// already-running stream.
/// and ends in the stream. Unframed log frames already contain enough information for
/// the decoder to know when they end, so framing is optional. However, without framing
/// the decoder must receive all bytes intact or it may "lose sync". With framing, it can
/// recover from missing/corrupted data, and can start decoding from the "middle" of an
/// already-running stream.
/// - Compression: The frame data has rather low entropy (for example, it contains many
/// zero bytes due to encoding all integers in fixed with, and will likely contain many
/// repetitions). Compression can decrease the on-the-wire required bandwidth.
/// zero bytes due to encoding all integers in fixed with, and will likely contain many
/// repetitions). Compression can decrease the on-the-wire required bandwidth.
///
/// defmt provides the `Encoder` separately instead of feeding already-encoded bytes
/// to the `Logger` because `Logger` implementations may decide to allow
Expand Down
12 changes: 12 additions & 0 deletions defmt/src/impls/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ use crate::{export, Format, Formatter, Str};
/// because this always uses `{:?}` to format the contained value.
pub struct Debug2Format<'a, T: fmt::Debug + ?Sized>(pub &'a T);

impl<T: fmt::Debug + ?Sized> fmt::Debug for Debug2Format<'_, T> {
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
self.0.fmt(fmt)
}
}

impl<T: fmt::Debug + ?Sized> Format for Debug2Format<'_, T> {
default_format!();

Expand Down Expand Up @@ -62,6 +68,12 @@ impl<T: fmt::Debug + ?Sized> Format for Debug2Format<'_, T> {
/// because this always uses `{}` to format the contained value.
pub struct Display2Format<'a, T: fmt::Display + ?Sized>(pub &'a T);

impl<T: fmt::Display + ?Sized> fmt::Display for Display2Format<'_, T> {
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
self.0.fmt(fmt)
}
}

impl<T: fmt::Display + ?Sized> Format for Display2Format<'_, T> {
default_format!();

Expand Down

0 comments on commit 7e99b89

Please sign in to comment.