moon/fory Apache Fory · MoonBit

API · fn

write_message

Messages · defined at codec.mbt:495

pub fn[T : Codec] write_message(Writer, T) -> Unit raise

Write a value as a complete message: the root's flag, the type ID, then everything after it.

The flag belongs to the message and not to the value — the specification's write_ref_or_null runs here as it runs before a nullable field — so it is written where the message is, and not in write_data, which belongs to the value. A message with no value in it is the flag alone.

Generated from src/pkg.generated.mbti and the doc comments beside this declaration.