Skip to main content

gen_opaque_struct

Function gen_opaque_struct 

Source
pub fn gen_opaque_struct(typ: &TypeDef, cfg: &RustBindingConfig<'_>) -> String
Expand description

Generate an opaque wrapper struct with inner: Arc<core::Type>. For trait types, uses Arc<dyn Type + Send + Sync>. For types with &mut self methods, uses Arc<Mutex<core::Type>>.

Special case: if ALL methods on this type are sanitized, the type was created by the impl-block fallback for a generic core type (e.g. GraphQLExecutor<Q,M,S>). Sanitized methods never access self.inner (they emit gen_unimplemented_body), so we omit the inner field entirely. This avoids generating Arc<CoreType> with missing generic parameters, which would fail to compile.