[][src]Function c_closures_build::enhance_closure_bindings

pub fn enhance_closure_bindings(rust_code: &str) -> String

Accepts a blob of auto generated rust code binding to a C/C++ library, probably from bindgen, analyzes it searching for instances of Closure definitions. When it finds them, it enhances the definition with additional functions that allow passing in a rust closure with a matching signature for the Closure definition. Outputs the initial blob, with the accompanying enhancements. This attempts to rustfmt the output, but if that fails will instead output rust code on a single line. That can make your error messages really ugly looking.