Expand description
Yog stable C ABI — the ONLY types that cross the mod/runtime boundary.
Rules this file must never break:
- Every type is
#[repr(C)]. - No Rust trait objects, no generics, no std types in public structs.
- Adding is a minor change: new fields go at the END of structs, new
callback types and functions are new names; increment
ABI_MINOR. - Anything else is a major change: removing (clean out what’s obsolete
then, here, in the runtime, the hosts’ JNI, yog-api), reordering,
changing a type or a meaning; increment
ABI_MAJOR,ABI_MINOR= 0.
Mods and the runtime are compiled independently; the runtime loads a mod
of its major version and a minor no newer than its own (compatible):
such a mod sees a prefix of every table, all of it there.
Modules§
- priority
- Where a subscriber runs among an event’s (higher first; equal ones in the order they subscribed).
- status
YogStatusvalues.
Structs§
- YogApi
- Passed to
yog_mod_register: the bus — everything a mod does goes through it (docs/design/bus.md) — and the one thing that can’t afford a message, the frame’s graphics. - YogBus
- The bus table — the whole boundary for everything but the per-frame
direct tables (
crate::YogGfxApi). - YogBytes
- Bytes handed across (
yog-data’s binary form), borrowed for the call. - YogColumn
- One fact’s values in one key space,
widthbytes a row: an inode, stored and written once however many mirrors link to it. - YogGfx
Api - Low-level GPU context passed to render handlers.
- YogKey
Slot - A key’s slot in a key space’s index (open addressing, linear probing).
- YogKey
Space - The things keyed alike (entities by network id, players, blocks by position): key → row, shared by every column of the space.
- YogReply
- Where a reply goes:
write(sink, …)with its bytes (once; nothing written is an empty reply). - YogStr
- Borrowed UTF-8 byte slice passed to a function. NOT null-terminated. Valid only for the duration of the call that provides it — never store.
Constants§
- ABI_
MAJOR - ABI_
MINOR - ABI_
VERSION ABI_MAJOR * 10_000 + ABI_MINOR. Checked at mod load time.- EMPTY_
SLOT - A slot no key ever took: a probe stops here.
- GONE_
SLOT - A slot whose key left: a probe goes on past it.
- NO_
ADDRESS - What
YogBus::resolvegives for an empty or malformed address.
Functions§
- compatible
- Whether a mod built for ABI
versionruns on this one: the same major, a minor no newer (what it knows is all here; later additions it doesn’t use).
Type Aliases§
- YogAddress
- An address resolved by
YogBus::resolve: an index, stable for the runtime’s lifetime, so hot calls don’t hash strings. - YogBytes
Sink - Takes bytes a handler writes (copies them; valid for the call).
- YogHandler
Fn - A provider or an event handler:
udas registered, the payload, where its reply goes. For an event, a reply replaces the payload the next handler (and finally the emitter) sees. - YogStatus
- How a call, an emit or a handler ended.