Skip to content

Commit a4c06b3

Browse files
authored
Merge pull request #28 from eval-exec/feat/serde
Add serde feature for faster-hex
2 parents 67f028e + c45c026 commit a4c06b3

File tree

3 files changed

+378
-1
lines changed

3 files changed

+378
-1
lines changed

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ exclude = [
1616
"CHANGELOG.md"
1717
]
1818

19+
[dependencies]
20+
serde = { version = "1.0", optional = true, features = ["derive"]}
21+
1922
[features]
20-
default = ["std"]
23+
default = ["std", "serde"]
2124
std = ["alloc"]
2225
alloc = []
26+
serde = ["dep:serde"]
2327

2428

2529

@@ -28,6 +32,9 @@ criterion = "0.3"
2832
rustc-hex = "1.0"
2933
hex = "0.3.2"
3034
proptest = "1.0"
35+
serde = { version = "1.0", features = ["derive"]}
36+
bytes = {version = "1.4.0"}
37+
serde_json ={ version = "*"}
3138

3239
[[bench]]
3340
name = "hex"

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ extern crate alloc;
66
mod decode;
77
mod encode;
88
mod error;
9+
10+
#[cfg(feature = "serde")]
11+
mod serde;
12+
913
pub use crate::decode::{
1014
hex_check, hex_check_fallback, hex_check_with_case, hex_decode, hex_decode_fallback,
1115
hex_decode_unchecked,
@@ -18,6 +22,12 @@ pub use crate::encode::{hex_string, hex_string_upper};
1822

1923
pub use crate::error::Error;
2024

25+
#[cfg(feature = "serde")]
26+
pub use crate::serde::{
27+
deserialize, nopfx_ignorecase, nopfx_lowercase, nopfx_uppercase, serialize, withpfx_ignorecase,
28+
withpfx_lowercase, withpfx_uppercase,
29+
};
30+
2131
#[allow(deprecated)]
2232
pub use crate::encode::hex_to;
2333

0 commit comments

Comments
 (0)