Skip to main content

Module native

Module native 

Source
Expand description

Native functions written as plain Rust closures over Values.

function builds a PHP function whose arguments arrive converted (objects and closures as Value::Opaque) and whose result or NativeError goes back to PHP. raw_function builds one that gets its arguments unconverted (Args): it converts only what it reads and passes the rest through as the zvals PHP gave it, for functions on a hot path. Every one runs through the same dispatcher, which finds the handler by the called function (by name the first time, then by the function itself) and goes through boundary::native_entry, so bailouts and panics never cross Rust frames. An area uses them from crate::NativeArea::functions.

Structs§

Args
The arguments of a raw_function call, as PHP passed them. Each accessor reads one argument; nothing is converted unless asked for.

Enums§

NativeError
How a native function fails in PHP.

Functions§

function
A PHP function name (namespaced names allowed) that takes any arguments and runs handler.
raw_function
A PHP function name that takes any arguments and runs handler over them unconverted. What it returns goes back to PHP; a value it passed through (Args::pass) goes back as the very same zval.

Type Aliases§

Handler
A native function’s body: the arguments it was given, converted.
RawHandler
A native function’s body that reads its arguments itself (Args).