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

Method module_version

crates/wasmtime/src/config.rs:2094–2106  ·  view source on GitHub ↗

Configure the version information used in serialized and deserialized [`crate::Module`]s. This effects the behavior of [`crate::Module::serialize()`], as well as [`crate::Module::deserialize()`] and related functions. The default strategy is to use the wasmtime crate's Cargo package version.

(&mut self, strategy: ModuleVersionStrategy)

Source from the content-addressed store, hash-verified

2092 ///
2093 /// The default strategy is to use the wasmtime crate's Cargo package version.
2094 pub fn module_version(&mut self, strategy: ModuleVersionStrategy) -> Result<&mut Self> {
2095 match strategy {
2096 // This case requires special precondition for assertion in SerializedModule::to_bytes
2097 ModuleVersionStrategy::Custom(ref v) => {
2098 if v.as_bytes().len() > 255 {
2099 bail!("custom module version cannot be more than 255 bytes: {v}");
2100 }
2101 }
2102 _ => {}
2103 }
2104 self.module_version = strategy;
2105 Ok(self)
2106 }
2107
2108 /// Configure whether wasmtime should compile a module using multiple
2109 /// threads.

Calls 3

OkFunction · 0.85
as_bytesMethod · 0.80
lenMethod · 0.45