Skip to content

Commit

Permalink
Merge pull request #28 from eval-exec/feat/serde
Browse files Browse the repository at this point in the history
Add serde feature for faster-hex
  • Loading branch information
zhangsoledad committed Mar 29, 2023
2 parents 67f028e + c45c026 commit a4c06b3
Show file tree
Hide file tree
Showing 3 changed files with 378 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ exclude = [
"CHANGELOG.md"
]

[dependencies]
serde = { version = "1.0", optional = true, features = ["derive"]}

[features]
default = ["std"]
default = ["std", "serde"]
std = ["alloc"]
alloc = []
serde = ["dep:serde"]



Expand All @@ -28,6 +32,9 @@ criterion = "0.3"
rustc-hex = "1.0"
hex = "0.3.2"
proptest = "1.0"
serde = { version = "1.0", features = ["derive"]}
bytes = {version = "1.4.0"}
serde_json ={ version = "*"}

[[bench]]
name = "hex"
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ extern crate alloc;
mod decode;
mod encode;
mod error;

#[cfg(feature = "serde")]
mod serde;

pub use crate::decode::{
hex_check, hex_check_fallback, hex_check_with_case, hex_decode, hex_decode_fallback,
hex_decode_unchecked,
Expand All @@ -18,6 +22,12 @@ pub use crate::encode::{hex_string, hex_string_upper};

pub use crate::error::Error;

#[cfg(feature = "serde")]
pub use crate::serde::{
deserialize, nopfx_ignorecase, nopfx_lowercase, nopfx_uppercase, serialize, withpfx_ignorecase,
withpfx_lowercase, withpfx_uppercase,
};

#[allow(deprecated)]
pub use crate::encode::hex_to;

Expand Down
Loading

0 comments on commit a4c06b3

Please sign in to comment.