Skip to main content

Module plan

Module plan 

Source
Expand description

The marshalling plan: the language-neutral calling contracts every backend renders, stated once.

The crate::model layer answers which symbols exist and what their C signatures are. This module answers the questions one level up, the ones the eleven generators used to answer independently (and inconsistently):

  • Errors (ErrorStrategy): when a call reports through out_err, is that a typed domain error the caller can catch, or a producer bug the wrapper must trap on?
  • Ownership (ReturnFree, ElemFree): after copying a returned value into a native one, exactly which runtime release call does the wrapper owe, if any?
  • Iterators (IteratorProtocol): the pull contract of iter<T>, including the requirement that wrappers stay lazy (one producer next per consumer step, never a hidden drain into a list).
  • Async (AsyncProtocol): the completion-callback contract, including the rule that result buffers are borrowed for the callback’s duration and must be copied before it returns.

A backend that renders these plans in its own syntax cannot drift from the others on semantics; only the spelling differs.

Structs§

AsyncProtocol
The async completion contract every backend renders.
IteratorProtocol
The iter<T> pull contract every backend renders.

Enums§

ElemFree
The release call a consumer wrapper owes for one element slot it copied out of an array, a map buffer, or an iterator next slot.
ErrorStrategy
How a callable’s out_err slot is interpreted by idiomatic wrappers.
ReturnFree
The release call(s) a consumer wrapper owes after copying a returned value into a native one.

Functions§

elem_free
The per-element release owed for one array/map/iterator element of type ty, declared inside module under prefix.
return_free
The release plan for a value of type ty returned from a callable declared inside module under prefix. None (a void return) owes nothing.