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

Function compute_module_path

crates/rust/src/lib.rs:1544–1567  ·  view source on GitHub ↗
(
    name: &WorldKey,
    resolve: &Resolve,
    is_export: bool,
)

Source from the content-addressed store, hash-verified

1542}
1543
1544pub(crate) fn compute_module_path(
1545 name: &WorldKey,
1546 resolve: &Resolve,
1547 is_export: bool,
1548) -> Vec<String> {
1549 let mut path = Vec::new();
1550 if is_export {
1551 path.push("exports".to_string());
1552 }
1553 match name {
1554 WorldKey::Name(name) => {
1555 path.push(to_rust_ident(name));
1556 }
1557 WorldKey::Interface(id) => {
1558 let iface = &resolve.interfaces[*id];
1559 let pkg = iface.package.unwrap();
1560 let pkgname = resolve.packages[pkg].name.clone();
1561 path.push(to_rust_ident(&pkgname.namespace));
1562 path.push(name_package_module(resolve, pkg));
1563 path.push(to_rust_ident(iface.name.as_ref().unwrap()));
1564 }
1565 }
1566 path
1567}
1568
1569enum Identifier<'a> {
1570 World(WorldId),

Callers 2

name_interfaceMethod · 0.85

Calls 5

newFunction · 0.85
to_rust_identFunction · 0.85
name_package_moduleFunction · 0.85
pushMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected