Expand description
L0, the core of the WASM runtime interface
(l0-design.md), as typed
Rust over Any.
One function per L0 function, under its L0 name, generic over IVm.
The types are Rust’s, not the ABI’s: an index is a u32, the bytes of
a string or a bigint are a slice, a container is built through a
Builder, and call answers a Result. dup and drop are
Clone and Drop, and an argument is borrowed unless the design says
the function takes it.
Where WASM traps, a function here panics, with the text the
FunctionalScript view of L0 throws, l0.<name>: <reason>, so the tests
below and that view’s proofs check the same preconditions.
An object answers its properties as Object::own_entries lists them:
each key once, array-index keys first, as a JavaScript host and the
FunctionalScript view do. NaNVM keeps an object’s properties as they
were written, so a read computes that view each time.
Modules§
- abi
- L0’s ABI over handles: step 2 of
todo/l0-interface.md.
Structs§
- Builder
- An open container: what L0’s
begin_arrayandbegin_objectanswer, filled bypushorpush_propertywith exactly the number of items it was begun with, then sealed.
Enums§
- Kind
- A value’s kind, as L0
kindanswers it. The tags are part of the ABI version.
Functions§
- begin_
array - L0
begin_array: a builder of an array oflenitems. - begin_
object - L0
begin_object: a builder of an object oflenproperties, before repeated keys merge. - call
- L0
call:fcalled withargs, a sealed array.Erris a thrown value, status 1 in the ABI. - concat
- L0
concat: two strings joined. - find
- L0
find: the index of the propertykeyof an object, or-1. The key must be a string. - frame
- L0
frame: the itemiof the frame of the function whose code is running, read through the code’sself_. - from_
bool - L0
from_bool, which also makes the constantstrueandfalse. - from_
f64 - L0
from_f64. ANaNloses its payload. - from_
unit - L0
from_unit: the string of one UTF-16 unit. - item
- L0
item: the itemiof an array, or the value of the propertyiof an object. - join
- L0
join: the strings of an array joined, withseparatorbetween two of them (l0-design.md§22). Each item and the separator must be strings. - key
- L0
key: the key of the propertyiof an object. - kind
- L0
kind. - length
- L0
length(l0-design.md§18): a string’s UTF-16 units, a bigint’su64words, an array’s items, an object’s properties, and a function’s declared parameters. - make_
bigint - L0
make_bigint: a sign,0,1or-1, and a magnitude inu64words, least significant first, in its canonical form only: no leading zero word, and the sign0for zero alone (l0-design.md§19). - make_
function - L0
make_function: a function ofcodeoverframe, a sealed array, declaringlengthparameters. NaNVM keeps a function’s text as a&'static str, where L0 passes a string value. - make_
string - L0
make_string: a string of UTF-16 units. - null
- L0
null. - read_
units - L0
read_units: the units ofsfromstart, as many asoutholds. - read_
words - L0
read_words: the words ofb’s magnitude fromstart, as many asoutholds. - same
- L0
same: whether two arrays, objects or functions are the same value. A primitive traps: L1 compares those by content. - sign
- L0
sign:0for zero,1for a positive bigint and-1for a negative one. - substring
- L0
substring: the units ofsfromstartup toend, wherestart <= end <= length. It neither clamps nor counts from the end. - text
- L0
text: a function’s text, orundefinedfor a function that has none. - to_bool
- L0
to_bool. - to_f64
- L0
to_f64. - undefined
- L0
undefined. - unit
- L0
unit: the UTF-16 unitiof a string.