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

Method emit_utils

crates/moonbit/src/async_support.rs:121–150  ·  view source on GitHub ↗
(&self, files: &mut Files, version: &str)

Source from the content-addressed store, hash-verified

119 }
120
121 pub(crate) fn emit_utils(&self, files: &mut Files, version: &str) {
122 if !self.is_async && self.futures.is_empty() {
123 return;
124 }
125
126 let mut body = Source::default();
127 wit_bindgen_core::generated_preamble(&mut body, version);
128 body.push_str(FFI);
129 files.push(&format!("{FFI_DIR}/top.mbt"), indent(&body).as_bytes());
130 ASYNC_UTILS.iter().for_each(|s| {
131 files.push(
132 &format!("{FFI_DIR}/{}.mbt", s.name),
133 indent(s.src).as_bytes(),
134 );
135 });
136 ASYNC_IMPL.iter().for_each(|s| {
137 files.push(
138 &format!("{ASYNC_DIR}/{}.mbt", s.name),
139 indent(s.src).as_bytes(),
140 );
141 });
142 files.push(
143 &format!("{ASYNC_DIR}/moon.pkg.json"),
144 indent(ASYNC_PKG_JSON).as_bytes(),
145 );
146 files.push(
147 &format!("{FFI_DIR}/moon.pkg.json"),
148 "{ \"warn-list\": \"-44\", \"supported-targets\": [\"wasm\"] }".as_bytes(),
149 );
150 }
151}
152
153/// Async-specific helpers used by `InterfaceGenerator` to keep the main

Callers 1

finishMethod · 0.80

Calls 6

generated_preambleFunction · 0.85
indentFunction · 0.70
is_emptyMethod · 0.45
push_strMethod · 0.45
pushMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected