[][src]Type Definition gojsonnet_sys::JsonnetNativeCallback

type JsonnetNativeCallback = Option<unsafe extern "C" fn(ctx: *mut c_void, argv: *const *const JsonnetJsonValue, success: *mut c_int) -> *mut JsonnetJsonValue>;

Callback to provide native extensions to Jsonnet.

The returned JsonnetJsonValue* should be allocated with jsonnet_realloc. It will be cleaned up along with the objects rooted at argv by libjsonnet when no-longer needed. Return a string upon failure, which will appear in Jsonnet as an error. The argv pointer is an array whose size matches the array of parameters supplied when the native callback was originally registered.

\param ctx User pointer, given in jsonnet_native_callback. \param argv Array of arguments from Jsonnet code. \param success Set this byref param to 1 to indicate success and 0 for failure. \returns The content of the imported file, or an error message.