Module apache_avro::serde_avro_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 serde_avro_bytes for non optional bytes.

See usage with below example:

use apache_avro::{serde_avro_bytes_opt, serde_avro_fixed_opt};
use serde::{Deserialize, Serialize};

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

    #[serde(with = "serde_avro_fixed_opt")]
    fixed_field: Option<[u8; 6]>,
}

Functions§