MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / validate_item_kind

Function validate_item_kind

crates/wizer/src/component/parse.rs:201–226  ·  view source on GitHub ↗
(kind: ComponentExternalKind, msg: &str)

Source from the content-addressed store, hash-verified

199}
200
201fn validate_item_kind(kind: ComponentExternalKind, msg: &str) -> Result<()> {
202 match kind {
203 // Aliasing modules would require keeping track of where a module's
204 // original definition is. There's not much usage of this in the wild
205 // so reject it for now as a simplifying assumption.
206 ComponentExternalKind::Module => {
207 bail!("wizer does not currently support module {msg}");
208 }
209
210 // Aliasing components deals with nested instantiations or similar,
211 // where a simplifying assumption is made to not worry about that for now.
212 ComponentExternalKind::Component => {
213 bail!("wizer does not currently support component {msg}");
214 }
215
216 // Like start sections, support for this is just deferred to some other
217 // time, if ever.
218 ComponentExternalKind::Value => {
219 bail!("wizer does not currently support value {msg}");
220 }
221
222 ComponentExternalKind::Func
223 | ComponentExternalKind::Type
224 | ComponentExternalKind::Instance => Ok(()),
225 }
226}

Callers 1

parse_intoFunction · 0.85

Calls 1

OkFunction · 0.85

Tested by

no test coverage detected