Iʼm trying to read a JSON stream, part of which looks like
"data": [
"c1a8f800a4393e0cacd05a5bc60ae3e0",
"bbac4013c1ca3482155b584d35dac185",
"685f237d4fcbd191c981b94ef6986cde",
"a08898e81f1ddb6612aa12641b856aa9"
]
(there are more entries in the data
list and each each entry is longer, but this should be illustrative; both the length of the list and the length of each hex string is known at compile time)
Ideally Iʼd want a single [u8; 64]
(the actual size is known at compile time), or failing that, a Vec<u8>
, but I imagine itʼs easier to deseriazie it as a Vec<[u8; 16]>
and merge them later. However, Iʼm having trouble doing even that.
The hex
crate has a way to deserialize a single hex string as a Vec
or array of u8
, but I canʼt figure out how to tell Serde to do that for each entry of the list. Is there a simple way to do that Iʼm overlooking, or do I need to write my own list deserializer?
deserialize()
function ofhex::serde
with a newtypeHash
the implementsDeserialize
. – Creel