Expand description
(De)serialize an optional Rust array (Option<[T; N]>) as an Avro Schema::Union([Schema::Null, Schema::Array]).
This module is intended to be used through the Serde with attribute.
Use apache_avro::serde::array for non-optional array values.
See usage with below example:
#[derive(AvroSchema, Serialize, Deserialize)]
struct StructWithArray {
#[avro(with = apache_avro::serde::array_opt::get_schema_in_ctxt::<i32>)]
#[serde(with = "apache_avro::serde::array_opt")]
array: Option<[i32; 10]>,
}Functionsยง
- deserialize
- get_
record_ fields_ in_ ctxt - Returns
None - get_
schema_ in_ ctxt - Returns
Schema::Union(Schema::Null, Schema::Array(T::get_schema_in_ctxt())) - serialize