pub enum JsonStorageKey {
Hash(B256),
Number(U256),
}Expand description
A storage key that accepts hex strings up to 32 bytes for eth_getStorageAt and eth_getProof.
A full-width, 32-byte input is stored as Hash and serializes at full width.
Shorter inputs are stored as Number and serialize as canonical quantities, so
their original prefix, letter case, and leading zeroes are not preserved. Self::as_b256
returns either representation left-padded to 32 bytes.
This distinction mirrors geth’s treatment of eth_getProof storage keys. See how input
storageKeys populate the returned StorageResult:
https://github.com/ethereum/go-ethereum/blob/00a73fbcce3250b87fc4160f3deddc44390848f4/internal/ethapi/api.go#L658-L690
Variants§
Hash(B256)
A full 32-byte key (tried first during deserialization)
Number(U256)
A number (fallback if B256 deserialization fails)
Implementations§
Trait Implementations§
Source§impl Clone for JsonStorageKey
impl Clone for JsonStorageKey
Source§fn clone(&self) -> JsonStorageKey
fn clone(&self) -> JsonStorageKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for JsonStorageKey
Source§impl Debug for JsonStorageKey
impl Debug for JsonStorageKey
Source§impl Default for JsonStorageKey
impl Default for JsonStorageKey
Source§impl<'de> Deserialize<'de> for JsonStorageKey
impl<'de> Deserialize<'de> for JsonStorageKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for JsonStorageKey
impl Display for JsonStorageKey
impl Eq for JsonStorageKey
Source§impl From<FixedBytes<32>> for JsonStorageKey
impl From<FixedBytes<32>> for JsonStorageKey
Source§impl From<Uint<256, 4>> for JsonStorageKey
impl From<Uint<256, 4>> for JsonStorageKey
Source§impl FromStr for JsonStorageKey
impl FromStr for JsonStorageKey
Source§impl PartialEq for JsonStorageKey
impl PartialEq for JsonStorageKey
Source§impl Serialize for JsonStorageKey
impl Serialize for JsonStorageKey
impl StructuralPartialEq for JsonStorageKey
Auto Trait Implementations§
impl Freeze for JsonStorageKey
impl RefUnwindSafe for JsonStorageKey
impl Send for JsonStorageKey
impl Sync for JsonStorageKey
impl Unpin for JsonStorageKey
impl UnsafeUnpin for JsonStorageKey
impl UnwindSafe for JsonStorageKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 40 bytes
Size for each variant:
Hash: 32 bytesNumber: 39 bytes