Module bytes_opt

Module bytes_opt 

Source
Expand description

Efficient (de)serialization of optional Avro bytes values.

This module is intended to be used through the Serde with attribute. Use apache_avro::serde::bytes for non-optional bytes.

See usage with below example:


#[derive(AvroSchema, Serialize, Deserialize)]
struct StructWithBytes {
    #[avro(with)]
    #[serde(with = "apache_avro::serde::bytes_opt")]
    vec_field: Option<Vec<u8>>,

    #[avro(with = apache_avro::serde::fixed_opt::get_schema_in_ctxt::<6>)]
    #[serde(with = "apache_avro::serde::fixed_opt")]
    fixed_field: Option<[u8; 6]>,
}

Functionsยง

deserialize
get_schema_in_ctxt
Returns Schema::Union(Schema::Null, Schema::Bytes)
serialize