1#![doc = include_str!("../README.md")]
2#![doc(
3 html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg",
4 html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico"
5)]
6#![cfg_attr(not(test), warn(unused_crate_dependencies))]
7#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
8#![cfg_attr(not(feature = "std"), no_std)]
9
10extern crate alloc;
11
12use alloc::format;
13use alloy_primitives::{hex, B256};
14use serde::Serializer;
15
16pub mod displayfromstr;
17
18mod optional;
19pub use self::optional::*;
20
21pub mod quantity;
22
23pub mod storage;
25pub use storage::JsonStorageKey;
26
27pub mod ttd;
28pub use ttd::*;
29
30mod other;
31pub use other::{OtherFields, WithOtherFields};
32
33pub fn serialize_hex_string_no_prefix<S, T>(x: T, s: S) -> Result<S::Ok, S::Error>
37where
38 S: Serializer,
39 T: AsRef<[u8]>,
40{
41 s.serialize_str(&hex::encode(x.as_ref()))
42}
43
44pub fn serialize_b256_hex_string_no_prefix<S>(x: &B256, s: S) -> Result<S::Ok, S::Error>
46where
47 S: Serializer,
48{
49 s.serialize_str(&format!("{x:x}"))
50}