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

Method from_path

cranelift/src/interpret.rs:70–78  ·  view source on GitHub ↗

Construct a file runner from a CLIF file path.

(path: impl Into<PathBuf>)

Source from the content-addressed store, hash-verified

68impl FileInterpreter {
69 /// Construct a file runner from a CLIF file path.
70 pub fn from_path(path: impl Into<PathBuf>) -> Result<Self, io::Error> {
71 let path = path.into();
72 log::trace!("New file runner from path: {}:", path.to_string_lossy());
73 let contents = fs::read_to_string(&path)?;
74 Ok(Self {
75 path: Some(path),
76 contents,
77 })
78 }
79
80 /// Construct a file runner from a CLIF code string. Currently only used for testing.
81 #[cfg(test)]

Callers

nothing calls this directly

Calls 2

read_to_stringFunction · 0.85
OkFunction · 0.85

Tested by

no test coverage detected