Revision control
Copy as Markdown
Other Tools
---
source: macro/src/lib.rs
expression: "rustfmt_code(&gen_bridge(parse_quote! {\n mod ffi\n {\n struct Foo {} impl Foo\n {\n pub fn bar(& self) -> Result < (), () >\n { unimplemented! () }\n }\n }\n }).to_token_stream().to_string())"
---
mod ffi {
#[repr(C)]
#[derive(Clone, Copy)]
struct Foo {}
impl Foo {
pub fn bar(&self) -> Result<(), ()> {
unimplemented!()
}
}
use diplomat_runtime::*;
#[no_mangle]
extern "C" fn Foo_bar(this: &Foo) -> diplomat_runtime::DiplomatResult<(), ()> {
this.bar().into()
}
#[no_mangle]
extern "C" fn Foo_destroy(this: Box<Foo>) {}
}