Function Encoder.writeMapStart
Call this to start a new map. See [writeArrayStart] for details on usage.
abstract void writeMapStart() @safe;
As an example of usage, let's say you want to write a map of records, the record consisting of an Long field and a Boolean field. Your code would look something like this:
out .writeMapStart();
out .setItemCount(list .size());
foreach (string key, GenericRecord value; map) {
out .startItem();
out .writeString(key);
out .writeLong(value .getField("longField") .getValue!long);
out .writeBoolean(value .getField("boolField") .getValue!bool);
}
out .writeMapEnd();
Throws
AvroTypeException If this is a stateful writer and a map is not expected