Standard Library · ffi
attribute shallow
Asserts that a foreign function uses little stack, so it runs on the task's own stack with no stack switch and no headroom check.
since 0.1.0-alpha.1linuxwindowswasm
Overview
Use it on small, hot functions such as strlen or cos. A function marked @shallow that needs more stack than the task has left overflows it, as it would in C. It may not be used on a function that can call back.
Examples
A small hot function
uses ffi;
use io::console;
@extern("c")
@shallow
int strlen(string s);
console.writeln(strlen("shallow"));
7
Fields
value
bool valueWhether the mark applies.