moon/fory Apache Fory · MoonBit

Reference

Every public item, one page each.

42 items: 20 functions, 2 values, 10 structs, 7 enums, 2 errors, 1 trait, and 112 methods documented on the pages of the types they belong to. The signatures and the prose are both taken from the package — moon info for the first, the /// comments beside each declaration for the second — so a page here cannot describe a function that no longer exists.

Messages

ItemKindSummary
CodectraitA value that knows how to become bytes, and how to come back from them.
dumpfnThe same, into a buffer the caller keeps: for a stream of messages written one after another, or for a buffer that already holds a header of its own.
dumpsfnOne value as one message: the head, the type ID, and the value.
loadfnOne value read out of a reader the caller owns, which is how several messages written one after another are read back: the reader keeps the position, and its configuration is the reader's.
loadsfnBytes as a value: the head is checked, the value is read, and the bytes left over are refused, because a message with two values in it is two messages.
read_messagefnRead one complete message: the root's flag first, then the type ID.
SharedstructA value that may be written more than once, or that takes part in a cycle.
sharedfnMark a value as one that may be shared.
write_messagefnWrite a value as a complete message: the root's flag, the type ID, then everything after it.

Configuration

ItemKindSummary
ClashederrorWhat OnClash::Panic raises: a setting given twice where the caller asked to hear about it.
ConfigstructWhat a reader will accept and what a writer will send.
configletThe preset every entry point takes when it is not given one.
OnClashenumWhat to do when the same setting is given twice, once in the record and once as a flat argument.
resolvefnThe configuration one call runs under.
WinsenumWhich of the two ways of giving a configuration wins when both are given.

Type IDs

ItemKindSummary
TypeIdenumThe internal type ID: the byte that begins a value's type meta, and the number every language agrees on.

Values

ItemKindSummary
read_bodyfnRead the body of a value whose type is already known.
read_valuefnRead a value: the type meta says what to build, and the body fills it.
ValueenumA value whose type travels with it.
write_bodyfnWrite the body of a value whose type meta is already on the wire: what a list element and a struct field are, once the header or the schema has said what they are.
write_valuefnWrite a value: the type meta that says what it is, then the body.
write_value_datafnEverything a value writes after its type ID: the user type ID for the kinds that carry one, then the body.

Writing

ItemKindSummary
root_keyletThe key the root value is tracked under, when tracking is on.
WriterstructWhere a value goes: a buffer, the configuration it is written under, and the table of what has already been sent.

Reading

ItemKindSummary
ReaderstructWhere a value comes from: the bytes, the place in them, and what has been read already.
RefFlagenumWhat the byte before a value can say about it.

Schemas

ItemKindSummary
compare_fieldfnWhich of two fields comes first, by the rules the specification lays down so that every language writes the same order.
FieldMetastructOne field of a struct: the description it carries, and what the wire needs that a description has no word for.
StructMetastructA struct type: the description every projection shares, the user type ID it is registered under, and one wire record per field.

Row format

ItemKindSummary
RowstructA builder for one row.
RowCursorstructA reader over one row's bytes, with random access to any field.
RowFieldstructOne field of a row schema: its name, its type, and whether it may be null.
RowSchemastructA row schema: the ordered list of fields a row is built and read against.
RowTypeenumThe type of one field in a row schema.
RowValueenumA value written into, or read out of, a row.

Time

ItemKindSummary
date_of_daysfnThe day count of a date, as the wire carries it: days since 1970-01-01.
days_of_datefnThe days since 1970-01-01 for a date.
moment_of_partsfnThe moment seconds after the epoch, plus nanos nanoseconds.
parts_of_momentfnThe whole seconds and the sub-second nanoseconds of a moment.
parts_of_spanfnThe whole seconds and the sub-second nanoseconds of a span.
span_of_partsfnThe span from seconds and nanos.

Refusals

ItemKindSummary
RefusederrorWhy a message was refused.

Regenerated, not written. python3 scripts/api.py writes this directory from src/pkg.generated.mbti and src/*.mbt; CI runs it and refuses a diff. A method links to its type's page under an anchor rather than to a page of its own, because a method is only readable next to the type it hangs off.