Skip to main content

Module abi

Module abi 

Source
Expand description

The calls compiled code makes into the runtime, exported unmangled as nf_*.

Ownership follows one rule: a call takes ownership of the values passed to it unless its parameter is a borrowed Slot, documented as such, and gives ownership of the values it returns, except getters, whose results are borrowed from their container. A call that can fail returns false after recording why in the context; compiled code then returns false itself, up to the runtime.

Every pointer passed in must be valid for the access the call makes, every Slot must hold a value of the type the call expects, and every context must be the one the runtime passed into the compiled code making the call. nf build upholds this for the code it emits, which nifty_rt_main’s caller vouches for.

ModulesΒ§

lists πŸ”’
Lists: building, reading, and changing them in place.
numbers πŸ”’
Arithmetic Cranelift has no instruction for.
state πŸ”’
The app’s state, calls between functions, and failures compiled code detects itself.
strings πŸ”’
Strings, and building interpolated strings.
structs πŸ”’
Structs: building, reading fields, and changing them in place.
values πŸ”’
Owning, comparing and storing values of any type.

FunctionsΒ§

borrow_context πŸ”’ ⚠
Safety
count πŸ”’
A list’s length, or a string’s, as an int. Allocations never exceed isize::MAX bytes, so the length always fits.