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

Function compile_module

crates/testing/src/sdk.rs:172–179  ·  view source on GitHub ↗

Note: this function is memoized to ensure we compile each module only once. Without this lock, if multiple `Test`s ran concurrently in the same process, the test harness would compile each module multiple times concurrently, which is bad both for performance reasons as well as can lead to errors with toolchains like .NET which don't expect parallel invocations of their build tools on the same proj

(module: &str)

Source from the content-addressed store, hash-verified

170// with toolchains like .NET which don't expect parallel invocations
171// of their build tools on the same project folder.
172fn compile_module(module: &str) -> (String, HostType) {
173 let module = module.to_owned();
174
175 memoized!(|module: String| -> (String, HostType) {
176 let module = CompiledModule::compile(module, CompilationMode::Debug);
177 (module.path().to_str().unwrap().to_owned(), module.host_type)
178 })
179}
180
181// Note: this function does not memoize because we want each test to publish the same
182// module as a separate clean database instance for isolation purposes.

Callers 2

eval_moduleFunction · 0.85
runMethod · 0.85

Calls 1

to_ownedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…