serde_utils/
lib.rs

1pub mod num;
2
3pub use num::*;
4
5use serde::Serializer;
6
7/// Serialize a byte vec as a hex string _without_ the "0x" prefix.
8///
9/// This behaves the same as [`hex::encode`](alloy_primitives::hex::encode).
10pub fn serialize_hex_string_no_prefix<S, T>(
11    x: T, s: S,
12) -> Result<S::Ok, S::Error>
13where
14    S: Serializer,
15    T: AsRef<[u8]>,
16{
17    s.serialize_str(&alloy_primitives::hex::encode(x.as_ref()))
18}