Debian Codegraph @

third_party/rust/diplomat/src/snapshots/diplomat__tests__method_taking_str.snap

raw
1 ---
2 source: macro/src/lib.rs
3 expression: "rustfmt_code(&gen_bridge(parse_quote! {\n mod ffi\n {\n struct Foo {} impl Foo\n { pub fn from_str(s : & DiplomatStr) { unimplemented! () } }\n }\n }).to_token_stream().to_string())"
4 ---
5 mod ffi {
6 #[repr(C)]
7 #[derive(Clone, Copy)]
8 struct Foo {}
9 impl Foo {
10 pub fn from_str(s: &DiplomatStr) {
11 unimplemented!()
12 }
13 }
14 use diplomat_runtime::*;
15 #[no_mangle]
16 extern "C" fn Foo_from_str(s_diplomat_data: *const u8, s_diplomat_len: usize) {
17 Foo::from_str(if s_diplomat_len == 0 {
18 Default::default()
19 } else {
20 unsafe { core::slice::from_raw_parts(s_diplomat_data, s_diplomat_len) }
21 })
22 }
23 #[no_mangle]
24 extern "C" fn Foo_destroy(this: Box<Foo>) {}
25 }
26