Encode a compatible value (implementing the
ToAvro trait) into Avro format, also
performing schema validation.
NOTE This function has a quite small niche of usage and does NOT generate headers and sync
Writer to be fully Avro-compatible if you don’t know what
you are doing, instead.