MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / with_module

Method with_module

crates/testing/src/modules.rs:239–252  ·  view source on GitHub ↗
(&self, config: Config, func: F)

Source from the content-addressed store, hash-verified

237 }
238
239 pub fn with_module<F>(&self, config: Config, func: F)
240 where
241 F: FnOnce(&Runtime, &ModuleHandle),
242 {
243 with_runtime(move |runtime| {
244 let module = runtime.block_on(async { self.load_module(config, None).await });
245 let env = module.env.clone();
246 let db_identity = module.db_identity;
247 let func_result = std::panic::catch_unwind(AssertUnwindSafe(|| func(runtime, &module)));
248 drop(module);
249
250 runtime.block_on(async { finish_module_test(&env, db_identity, func_result).await });
251 });
252 }
253
254 /// Load a module with the given config.
255 /// If "reuse_db_path" is set, the module will be loaded in the given path,

Callers

nothing calls this directly

Calls 5

with_runtimeFunction · 0.85
finish_module_testFunction · 0.85
load_moduleMethod · 0.80
block_onMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected