Skip to main content

PhpBridgeGenerator

Struct PhpBridgeGenerator 

Source
pub struct PhpBridgeGenerator {
    pub core_import: String,
    pub type_paths: HashMap<String, String>,
    pub error_type: String,
}
Expand description

PHP-specific trait bridge generator. Implements code generation for bridging PHP objects to Rust traits.

Fields§

§core_import: String

Core crate import path (e.g., "kreuzberg").

§type_paths: HashMap<String, String>

Map of type name → fully-qualified Rust path for type references.

§error_type: String

Error type name (e.g., "KreuzbergError").

Trait Implementations§

Source§

impl TraitBridgeGenerator for PhpBridgeGenerator

Source§

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>

Additional use imports needed for the bridge code.
Source§

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

Generate the body of an async method bridge. Read more
Source§

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

Generate the complete registration function including attributes, signature, and body. Read more

Auto Trait Implementations§

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.