Skip to main content

gen_ffi_error_methods

Function gen_ffi_error_methods 

Source
pub fn gen_ffi_error_methods(
    error: &ErrorDef,
    core_import: &str,
    api_prefix: &str,
) -> String
Expand description

Generate #[no_mangle] extern "C" helper functions for the whitelisted introspection methods (status_code, is_transient, error_type) declared in error.methods.

Each function follows the opaque-pointer convention: accepts a *const {rust_path} (null-checked before dereference) and returns the method’s value. For error_type an additional *_error_type_free companion is emitted so callers can release the CString-allocated memory.

Returns an empty string when error.methods is empty.