Skip to main content

Crate webui_ffi

Crate webui_ffi 

Source
Expand description

WebUI FFI (Foreign Function Interface) for interoperability with other languages.

This crate provides C-compatible APIs for the WebUI handler to be used from languages like Go, C#, Python, etc.

§Quick Start

The simplest way to render an HTML template with data:

char *result = webui_render("<h1>{{title}}</h1>", "{\"title\":\"Hello\"}");
if (result == NULL) {
    const char *err = webui_last_error();
    // handle error...
} else {
    // use result...
    webui_free(result);
}

§Error Handling

All functions that can fail return NULL on error. Call webui_last_error to retrieve a human-readable error message. The error string is valid until the next FFI call on the same thread (follows the POSIX dlerror() pattern).

Functions§

webui_free⚠
Free a string returned by a WebUI FFI function.
webui_handler_create
Create a new WebUI handler instance.
webui_handler_create_with_plugin⚠
Create a new WebUI handler instance with a named plugin.
webui_handler_destroy⚠
Destroy a WebUI handler instance.
webui_handler_render⚠
Render a WebUI protocol (protobuf binary) with JSON data.
webui_last_error
Return the last error message, or NULL if no error has occurred.
webui_render⚠
Parse an HTML template and render it with JSON data in a single call.
webui_render_partial⚠
Produce a complete JSON partial response for client-side navigation.