Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for defmt log using a new feature #54

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading