Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
569: Support defmt version span 0.2 to 0.3 r=Dirbaio a=korken89

A trick to support multiple versions of `defmt`. This allows the user crate to select the version in the end.

Co-authored-by: Emil Fresk <[email protected]>
  • Loading branch information
bors[bot] and korken89 authored Nov 16, 2021
2 parents 8e6fc7f + 7f5747a commit 0dfe66b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Failure is permitted on nightly.
rust:
- stable
- 1.53.0
- 1.56.0
- nightly

features:
Expand Down Expand Up @@ -68,13 +68,13 @@ jobs:
# Failure is permitted on nightly.
rust:
- stable
- 1.53.0
- 1.56.0
- nightly

features:
# These feature sets cannot run tests, so we only check they build.
- rand-custom-impl medium-ip medium-ethernet medium-ieee802154 proto-ipv6 proto-ipv6 proto-igmp proto-dhcpv4 socket-raw socket-udp socket-tcp socket-icmp async
- rand-custom-impl defmt defmt-trace medium-ip medium-ethernet proto-ipv6 proto-ipv6 proto-igmp proto-dhcpv4 socket-raw socket-udp socket-tcp socket-icmp async
- rand-custom-impl defmt medium-ip medium-ethernet proto-ipv6 proto-ipv6 proto-igmp proto-dhcpv4 socket-raw socket-udp socket-tcp socket-icmp async

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ byteorder = { version = "1.0", default-features = false }
log = { version = "0.4.4", default-features = false, optional = true }
libc = { version = "0.2.18", optional = true }
bitflags = { version = "1.0", default-features = false }
defmt = { version = "0.2.0", optional = true }
defmt = { version = "0.3", optional = true }
rand_core = { version = "0.6.3", optional = true, default-features = false }

[dev-dependencies]
Expand Down Expand Up @@ -57,12 +57,6 @@ rand-custom-impl = []

"async" = []

defmt-trace = []
defmt-debug = []
defmt-info = []
defmt-warn = []
defmt-error = []

default = [
"std", "log", # needed for `cargo test --no-default-features --features default` :/
"medium-ethernet", "medium-ip", "medium-ieee802154",
Expand Down
3 changes: 3 additions & 0 deletions src/wire/ieee802154.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl fmt::Display for AddressingMode {

/// A IEEE 802.15.4 PAN.
#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct Pan(pub u16);

impl Pan {
Expand All @@ -82,6 +83,7 @@ impl Pan {

/// A IEEE 802.15.4 address.
#[derive(Debug, Hash, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Address {
Absent,
Short([u8; 2]),
Expand Down Expand Up @@ -745,6 +747,7 @@ impl<T: AsRef<[u8]>> fmt::Display for Frame<T> {

/// A high-level representation of an IEEE802.15.4 frame.
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct Repr {
pub frame_type: FrameType,
pub security_enabled: bool,
Expand Down

0 comments on commit 0dfe66b

Please sign in to comment.