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

Function wasmtime_config_cache_config_load

crates/c-api/src/config.rs:250–271  ·  view source on GitHub ↗
(
    c: &mut wasm_config_t,
    filename: *const c_char,
)

Source from the content-addressed store, hash-verified

248#[unsafe(no_mangle)]
249#[cfg(feature = "cache")]
250pub unsafe extern "C" fn wasmtime_config_cache_config_load(
251 c: &mut wasm_config_t,
252 filename: *const c_char,
253) -> Option<Box<wasmtime_error_t>> {
254 use std::path::Path;
255
256 use wasmtime::Cache;
257
258 handle_result(
259 if filename.is_null() {
260 Cache::from_file(None).map(|cache| c.config.cache(Some(cache)))
261 } else {
262 match CStr::from_ptr(filename).to_str() {
263 Ok(s) => {
264 Cache::from_file(Some(&Path::new(s))).map(|cache| c.config.cache(Some(cache)))
265 }
266 Err(e) => Err(e.into()),
267 }
268 },
269 |_cfg| {},
270 )
271}
272
273#[unsafe(no_mangle)]
274pub extern "C" fn wasmtime_config_memory_may_move_set(c: &mut wasm_config_t, enable: bool) {

Callers 2

cache_load_defaultMethod · 0.85
cache_loadMethod · 0.85

Calls 6

handle_resultFunction · 0.85
is_nullMethod · 0.80
to_strMethod · 0.80
newFunction · 0.50
mapMethod · 0.45
cacheMethod · 0.45

Tested by

no test coverage detected