Skip to content

Commit

Permalink
Merge pull request #3 from BridgeSource/0.6.1
Browse files Browse the repository at this point in the history
0.6.1
  • Loading branch information
amcelroy authored Nov 16, 2023
2 parents 3a946af + b0af22e commit 5120739
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "flem"
version = "0.6.0"
version = "0.6.1"
edition = "2021"
description = "Flexible, Light-weight, Embedded Messaging Protocol"
repository = "https://github.com/BridgeSource/flem-rs.git"
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Endian messaging protocol intended for use in communicating with embedded
systems targets over numerous types of buses.

## Changelog

### Changelog 0.6.1
- Added fmt::Debug trait to Packet that prints the header, checksum, request, response, length, and status.

### Changelog 0.6.0 (from 0.5.0)
- Requests are now 2 byte u16 instead of 1 byte u8
- Responses are now 2 byte u16 instead of 1 byte u8
Expand Down
21 changes: 21 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![no_std]

use core::fmt::{Debug, Error, Formatter};

pub mod buffer;
pub mod traits;

Expand Down Expand Up @@ -694,3 +696,22 @@ impl<const T: usize> Packet<T> {
return x;
}
}

impl<const T: usize> Debug for Packet<T> {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
let header = self.header;
let checksum = self.checksum;
let request = self.request;
let response = self.response;
let length = self.length;

f.debug_struct("Packet")
.field("header", &header)
.field("checksum", &checksum)
.field("request", &request)
.field("response", &response)
.field("length", &length)
.field("status", &self.status)
.finish()
}
}

0 comments on commit 5120739

Please sign in to comment.