MCPcopy Create free account
hub / github.com/bytecodealliance/wit-bindgen / generate_stub_impl

Method generate_stub_impl

crates/rust/src/interface.rs:1367–1397  ·  view source on GitHub ↗
(
        &mut self,
        trait_name: &str,
        extra_trait_items: &str,
        funcs: &[&Function],
        interface: Option<(InterfaceId, &WorldKey)>,
    )

Source from the content-addressed store, hash-verified

1365 }
1366
1367 fn generate_stub_impl(
1368 &mut self,
1369 trait_name: &str,
1370 extra_trait_items: &str,
1371 funcs: &[&Function],
1372 interface: Option<(InterfaceId, &WorldKey)>,
1373 ) {
1374 uwriteln!(self.src, "impl {trait_name} for Stub {{");
1375 self.src.push_str(extra_trait_items);
1376
1377 for func in funcs {
1378 if self.r#gen.skip.contains(&func.name) {
1379 continue;
1380 }
1381 let async_ = self
1382 .r#gen
1383 .is_async(self.resolve, interface.map(|p| p.1), func, false);
1384 let mut sig = FnSig {
1385 async_,
1386 use_item_name: true,
1387 private: true,
1388 ..Default::default()
1389 };
1390 sig.update_for_func(&func);
1391 self.src.push_str("#[allow(unused_variables)]\n");
1392 self.print_signature(func, true, &sig);
1393 self.src.push_str("{ unreachable!() }\n");
1394 }
1395
1396 self.src.push_str("}\n");
1397 }
1398
1399 fn rustdoc(&mut self, docs: &Docs) {
1400 let docs = match &docs.contents {

Callers 1

generate_stubMethod · 0.80

Calls 5

mapMethod · 0.80
update_for_funcMethod · 0.80
push_strMethod · 0.45
is_asyncMethod · 0.45
print_signatureMethod · 0.45

Tested by

no test coverage detected