Skip to content

Commit

Permalink
Merge pull request #54 from Georges760/feature-defmt
Browse files Browse the repository at this point in the history
add support for defmt log using a new feature
  • Loading branch information
zhangsoledad authored Sep 23, 2024
2 parents cc0da4a + 67aef22 commit b528490
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,22 @@ exclude = [
]

[dependencies]
defmt = { version = "0.3", optional = true }
serde = { version = "1.0", default-features = false, optional = true }

[features]
default = ["std", "serde"]
std = ["alloc", "serde?/std"]
alloc = []
alloc = ["defmt?/alloc"]
serde = ["dep:serde", "alloc"]
defmt-03 = ["dep:defmt"]

[target.'cfg(not(feature = "alloc"))'.dependencies]
heapless = { version = "0.8" }

[target.'cfg(not(feature = "alloc"))'.features]
defmt-03 = ["dep:defmt", "heapless/defmt-03"]

[dev-dependencies]
criterion = "0.5"
rustc-hex = "1.0"
Expand Down
1 change: 1 addition & 0 deletions src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ pub unsafe fn hex_check_sse(src: &[u8]) -> bool {
}

#[derive(Eq, PartialEq)]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum CheckCase {
None,
Lower,
Expand Down
1 change: 1 addition & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#[derive(Clone, Copy, PartialEq)]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub enum Error {
InvalidChar,
InvalidLength(usize),
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub use crate::encode::hex_to;
pub use crate::decode::{hex_check_sse, hex_check_sse_with_case};

#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt-03", derive(defmt::Format))]
pub(crate) enum Vectorization {
None = 0,
SSE41 = 1,
Expand Down

0 comments on commit b528490

Please sign in to comment.