Skip to main content

RustBindingConfig

Struct RustBindingConfig 

Source
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 str

Attr placed on the constructor, e.g. "#[new]".

§static_attr: Option<&'a str>

Attr placed on static methods, e.g. Some("staticmethod").

§function_attr: &'a str

Attr 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: bool

Whether the backend requires #[pyo3(signature = (...))]-style annotations.

§signature_prefix: &'a str

Prefix for the signature annotation, e.g. "#[pyo3(signature = (".

§signature_suffix: &'a str

Suffix for the signature annotation, e.g. "))]".

§core_import: &'a str

Core crate import path, e.g. "liter_llm". Used to generate calls into core.

§async_pattern: AsyncPattern

Async pattern supported by this backend.

§has_serde: bool

Whether 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 str

Prefix 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: bool

When 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.

Auto Trait Implementations§

§

impl<'a> Freeze for RustBindingConfig<'a>

§

impl<'a> RefUnwindSafe for RustBindingConfig<'a>

§

impl<'a> Send for RustBindingConfig<'a>

§

impl<'a> Sync for RustBindingConfig<'a>

§

impl<'a> Unpin for RustBindingConfig<'a>

§

impl<'a> UnsafeUnpin for RustBindingConfig<'a>

§

impl<'a> UnwindSafe for RustBindingConfig<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.