- A thin layer over the C ABI. One file per header,
types.go,model.go,encode.goandtrain.go; every name is its C name withoutuform_and_tin PascalCase, a verb’s argument struct becomes its*Config, and every wrapper’s documentation names the C symbol it calls or says it is binding-only. - The receiver chooses, the verb stays. The model runs a verb on the calling goroutine,
On(executor)blocks on an executor, andDeferred(executor)submits it, all with the same arguments. - Deferred calls use the language’s own idioms.
Statuspolls throughuform_outcome_statusandWaitblocks throughuform_outcome_wait, and refusals answer before anything is submitted. - No life of its own. The binding starts no goroutines and keeps no queues, locks or counts; releasing a
DeferredridesClose, which waits for the call first, or the collector’s cleanup, which frees it only once final. - Arenas belong to the caller and are reused, never shared. Every output whose length scales with the call lands in an arena the caller passes, and its views end at the arena’s next call.
- One pinned frame per call. A call’s outcome, argument struct, callback handles and result share one allocation holding no unpinned Go pointer, since cgo pins only heap objects.
- Suites run against the stub library, and
TestCallsAllocateOnlyTheirFramespins the budgets below.
| Path | Go | Rust |
|---|---|---|
| Blocking call | 1 frame | 0 |
| Refusal before the call | 1 Error | 1 error |
| Deferred submit and wait | 4: frame, Deferred, 2 in AddCleanup | 0 |
| Each callback | 1 handle | 0 |