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

Function c_func_name

crates/c/src/lib.rs:1281–1307  ·  view source on GitHub ↗
(
    in_import: bool,
    resolve: &Resolve,
    world: &str,
    interface_id: Option<&WorldKey>,
    func: &Function,
    renamed_interfaces: &HashMap<WorldKey, String>,
)

Source from the content-addressed store, hash-verified

1279}
1280
1281pub fn c_func_name(
1282 in_import: bool,
1283 resolve: &Resolve,
1284 world: &str,
1285 interface_id: Option<&WorldKey>,
1286 func: &Function,
1287 renamed_interfaces: &HashMap<WorldKey, String>,
1288) -> String {
1289 let mut name = String::new();
1290 match interface_id {
1291 Some(id) => name.push_str(&interface_identifier(
1292 id,
1293 resolve,
1294 !in_import,
1295 renamed_interfaces,
1296 )),
1297 None => {
1298 if !in_import {
1299 name.push_str("exports_");
1300 }
1301 name.push_str(&world.to_snake_case());
1302 }
1303 }
1304 name.push_str("_");
1305 name.push_str(&func.name.to_snake_case().replace('.', "_"));
1306 name
1307}
1308
1309struct InterfaceGenerator<'a> {
1310 src: Source,

Callers 1

c_func_nameMethod · 0.85

Calls 3

newFunction · 0.85
interface_identifierFunction · 0.85
push_strMethod · 0.45

Tested by

no test coverage detected