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

Method path_to_root

crates/rust/src/interface.rs:406–431  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

404 }
405
406 pub(crate) fn path_to_root(&self) -> String {
407 let mut path_to_root = String::new();
408
409 match self.identifier {
410 Identifier::Interface(_, key) => {
411 // Escape the submodule for this interface
412 path_to_root.push_str("super::");
413
414 // Escape the `exports` top-level submodule
415 if !self.in_import {
416 path_to_root.push_str("super::");
417 }
418
419 // Escape the namespace/package submodules for interface-based ids
420 match key {
421 WorldKey::Name(_) => {}
422 WorldKey::Interface(_) => {
423 path_to_root.push_str("super::super::");
424 }
425 }
426 }
427 Identifier::StreamOrFuturePayload => path_to_root.push_str("super::super::"),
428 _ => {}
429 }
430 path_to_root
431 }
432
433 pub fn start_append_submodule(&mut self, name: &WorldKey) -> (String, Vec<String>) {
434 let snake = match name {

Callers 4

finishMethod · 0.80
path_to_interfaceMethod · 0.80
emitMethod · 0.80

Calls 2

newFunction · 0.85
push_strMethod · 0.45

Tested by

no test coverage detected