Skip to main content

to_avro_datum

Function to_avro_datum 

Source
pub fn to_avro_datum<T: Into<Value>>(
    schema: &Schema,
    value: T,
) -> AvroResult<Vec<u8>>
๐Ÿ‘ŽDeprecated since 0.22.0:

Use GenericDatumWriter instead

Expand description

Deprecated. Use GenericDatumWriter instead.

This is equivalent to:

โ“˜
GenericDatumWriter::builder(schema)
    .build()?
    .write_value_to_vec(value)

Encode a value into raw Avro data, also performs schema validation.

NOTE: This function has a quite small niche of usage and does NOT generate headers and sync markers; use Writer to be fully Avro-compatible if you donโ€™t know what you are doing, instead.