-
-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Description
For structs like:
struct TupSt<K,V>(K,V);
struct OdnSt<K,V>{
custom_key: K,
v: V,
// #[serde(skip)]
// serde_skipped_fields
}And implemented From<(K,V)> and Into<(K,V)>, allow them to be used inner type of Seq.
Expected behaviour
#[serde_as]
pub struct Data {
#[serde_as(as = "Seq<TupSt<_,_>>")]
tuple_map: BTreeMap<i32,i32>,
#[serde_as(as = "Seq<OdnSt<_,_>>")]
ordinary_map: BTreeMap<i32,i32>,
}Can be serialized into (or deserialized from):
{
"tuple_map": [
{"key": 1, "value": 1},
{"key": 2, "value": 2},
{"key": 3, "value": 3},
{"key": 4, "value": 4}
],
"ordinary_map": [
{"custom_key": 1, "v": 1},
{"custom_key": 2, "v": 2},
{"custom_key": 3, "v": 3},
{"custom_key": 4, "v": 4},
]
}Motivation
I've been trying to implement reading from Iceberg's AVRO files, and using apache-avro Serde API to read Iceberg encoded Maps will produce an array of small, key-value with naming tuples.
Metadata
Metadata
Assignees
Labels
No labels