pub struct RustBindingConfig<'a> {Show 17 fields
pub struct_attrs: &'a [&'a str],
pub field_attrs: &'a [&'a str],
pub struct_derives: &'a [&'a str],
pub method_block_attr: Option<&'a str>,
pub constructor_attr: &'a str,
pub static_attr: Option<&'a str>,
pub function_attr: &'a str,
pub enum_attrs: &'a [&'a str],
pub enum_derives: &'a [&'a str],
pub needs_signature: bool,
pub signature_prefix: &'a str,
pub signature_suffix: &'a str,
pub core_import: &'a str,
pub async_pattern: AsyncPattern,
pub has_serde: bool,
pub type_name_prefix: &'a str,
pub option_duration_on_defaults: bool,
}Expand description
Configuration for Rust binding code generation.
Fields§
§struct_attrs: &'a [&'a str]Attrs applied to generated structs, e.g. ["pyclass(frozen)"].
field_attrs: &'a [&'a str]Attrs applied to each field, e.g. ["pyo3(get)"].
struct_derives: &'a [&'a str]Derives applied to generated structs, e.g. ["Clone"].
method_block_attr: Option<&'a str>Attr wrapping the impl block, e.g. Some("pymethods").
constructor_attr: &'a strAttr placed on the constructor, e.g. "#[new]".
static_attr: Option<&'a str>Attr placed on static methods, e.g. Some("staticmethod").
function_attr: &'a strAttr placed on free functions, e.g. "#[pyfunction]".
enum_attrs: &'a [&'a str]Attrs applied to generated enums, e.g. ["pyclass(eq, eq_int)"].
enum_derives: &'a [&'a str]Derives applied to generated enums, e.g. ["Clone", "PartialEq"].
needs_signature: boolWhether the backend requires #[pyo3(signature = (...))]-style annotations.
signature_prefix: &'a strPrefix for the signature annotation, e.g. "#[pyo3(signature = (".
signature_suffix: &'a strSuffix for the signature annotation, e.g. "))]".
core_import: &'a strCore crate import path, e.g. "liter_llm". Used to generate calls into core.
async_pattern: AsyncPatternAsync pattern supported by this backend.
has_serde: boolWhether serde/serde_json are available in the output crate’s dependencies.
When true, the generator can use serde-based param conversion and add serde::Serialize derives.
When false, non-convertible Named params fall back to gen_unimplemented_body.
type_name_prefix: &'a strPrefix for binding type names (e.g. “Js” for NAPI/WASM, “” for PyO3/PHP).
Used in impl block targets: impl {prefix}{TypeName}.
option_duration_on_defaults: boolWhen true, non-optional Duration fields on has_default types are emitted as
Option<u64> in the binding struct so that unset fields fall back to the core
type’s Default implementation rather than Duration::ZERO.
Used by PyO3 to prevent validation failures when request_timeout is unset.