Skip to main content

Module bigdecimal

Module bigdecimal 

Source
Expand description

(De)serialize BigDecimal as a Schema::BigDecimal instead of a Schema::String.

This module is intended to be used through the Serde with attribute.

Use apache_avro::serde::bigdecimal_opt for optional big decimals values.

When used with different serialization formats, this will write bytes.

See usage with below example:

#[derive(AvroSchema, Serialize, Deserialize)]
struct StructWithBigDecimal {
    #[avro(with)]
    #[serde(with = "apache_avro::serde::bigdecimal")]
    decimal: BigDecimal,
}

Functionsยง

deserialize
get_record_fields_in_ctxt
Returns None
get_schema_in_ctxt
Returns Schema::BigDecimal
serialize