pub struct ZigTraitBridgeGenerator {
pub prefix: String,
}Expand description
Zig-specific TraitBridgeGenerator implementation.
Carries the FFI symbol prefix (e.g., "kreuzberg") used when deriving the
C symbol for unregister_* and clear_* wrappers.
The required trait methods that produce Rust source (gen_sync_method_body,
gen_async_method_body, gen_constructor, gen_registration_fn) return
empty strings because Zig bridge code is produced by the standalone
[emit_trait_bridge] free function, not the shared driver.
Fields§
§prefix: StringFFI symbol prefix (e.g., "kreuzberg").
Implementations§
Trait Implementations§
Source§impl TraitBridgeGenerator for ZigTraitBridgeGenerator
impl TraitBridgeGenerator for ZigTraitBridgeGenerator
Source§fn gen_unregistration_fn(&self, spec: &TraitBridgeSpec<'_>) -> String
fn gen_unregistration_fn(&self, spec: &TraitBridgeSpec<'_>) -> String
Emit a Zig wrapper that calls c.{prefix}_{unregister_fn}(name, out_error).
Returns an empty string when spec.bridge_config.unregister_fn is None.
Source§fn gen_clear_fn(&self, spec: &TraitBridgeSpec<'_>) -> String
fn gen_clear_fn(&self, spec: &TraitBridgeSpec<'_>) -> String
Emit a Zig wrapper that calls c.{prefix}_{clear_fn}(out_error).
Returns an empty string when spec.bridge_config.clear_fn is None.
Source§fn foreign_object_type(&self) -> &str
fn foreign_object_type(&self) -> &str
The type of the wrapped foreign object (e.g.,
"Py<PyAny>", "ThreadsafeFunction").Source§fn bridge_imports(&self) -> Vec<String>
fn bridge_imports(&self) -> Vec<String>
Additional
use imports needed for the bridge code.Source§fn gen_sync_method_body(
&self,
_method: &MethodDef,
_spec: &TraitBridgeSpec<'_>,
) -> String
fn gen_sync_method_body( &self, _method: &MethodDef, _spec: &TraitBridgeSpec<'_>, ) -> String
Generate the body of a synchronous method bridge. Read more
Source§fn gen_async_method_body(
&self,
_method: &MethodDef,
_spec: &TraitBridgeSpec<'_>,
) -> String
fn gen_async_method_body( &self, _method: &MethodDef, _spec: &TraitBridgeSpec<'_>, ) -> String
Generate the body of an async method bridge. Read more
Source§fn gen_constructor(&self, _spec: &TraitBridgeSpec<'_>) -> String
fn gen_constructor(&self, _spec: &TraitBridgeSpec<'_>) -> String
Generate the constructor body that validates and wraps the foreign object. Read more
Source§fn gen_registration_fn(&self, _spec: &TraitBridgeSpec<'_>) -> String
fn gen_registration_fn(&self, _spec: &TraitBridgeSpec<'_>) -> String
Generate the complete registration function including attributes, signature, and body. Read more
Source§fn async_trait_is_send(&self) -> bool
fn async_trait_is_send(&self) -> bool
Auto Trait Implementations§
impl Freeze for ZigTraitBridgeGenerator
impl RefUnwindSafe for ZigTraitBridgeGenerator
impl Send for ZigTraitBridgeGenerator
impl Sync for ZigTraitBridgeGenerator
impl Unpin for ZigTraitBridgeGenerator
impl UnsafeUnpin for ZigTraitBridgeGenerator
impl UnwindSafe for ZigTraitBridgeGenerator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more