Expand description
Efficient (de)serialization of Avro bytes/fixed borrowed values.
This module is intended to be used through the Serde with attribute.
Note that &[u8] are always serialized as Value::Bytes. However,
both Value::Bytes and Value::Fixed can be deserialized as &[u8].
Use apache_avro::serde::slice_opt for optional bytes/fixed borrowed values.
When used with different serialization formats, this is equivalent to serde_bytes.
See usage with below example:
#[derive(AvroSchema, Serialize, Deserialize)]
struct StructWithBytes<'a> {
#[avro(with)]
#[serde(with = "apache_avro::serde::slice")]
slice_field: &'a [u8],
}Functionsยง
- deserialize
- get_
record_ fields_ in_ ctxt - Returns
None - get_
schema_ in_ ctxt - Returns
Schema::Bytes - serialize