pub struct FfiConfig {
pub prefix: Option<String>,
pub error_style: String,
pub header_name: Option<String>,
pub lib_name: Option<String>,
pub visitor_callbacks: bool,
pub features: Option<Vec<String>>,
pub serde_rename_all: Option<String>,
pub exclude_functions: Vec<String>,
pub exclude_types: Vec<String>,
pub rename_fields: HashMap<String, String>,
pub plugin_error_constructor: Option<String>,
}Fields§
§prefix: Option<String>§error_style: String§header_name: Option<String>§lib_name: Option<String>Native library name for Go cgo/Java Panama/C# P/Invoke (e.g., “ts_pack_ffi”).
Defaults to {prefix}_ffi.
visitor_callbacks: boolIf true, generate visitor/callback FFI support.
features: Option<Vec<String>>§serde_rename_all: Option<String>Override the serde rename_all strategy for JSON field names (e.g. “camelCase”, “snake_case”). When set, this takes priority over the IR type-level serde_rename_all.
exclude_functions: Vec<String>Functions to exclude from FFI binding generation.
exclude_types: Vec<String>Types to exclude from FFI binding generation.
rename_fields: HashMap<String, String>Per-field name remapping for this language. Key is TypeName.field_name, value is the
desired binding field name. Applied after automatic keyword escaping.
plugin_error_constructor: Option<String>Rust expression used to construct an error value of this crate’s
error_type from a runtime String message inside generated FFI
trait-bridge plugin shims (plugin_impl_initialize, plugin_impl_shutdown).
The expression has access to a local variable msg: String containing
the underlying error message and is interpolated verbatim. Example
values:
# downstream whose error type has a struct variant with two fields:
plugin_error_constructor = """
kreuzberg::KreuzbergError::Plugin { message: msg, plugin_name: String::new() }
"""
# downstream whose error type implements `From<String>`:
plugin_error_constructor = "MyError::from(msg)"Defaults to None. When unset, the plugin shim still emits — backends
fall back to a format!("{}: {}", prefix, msg)-style construction via
the configured error_constructor. Downstreams that don’t expose
trait-bridged plugins can ignore this knob entirely.