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

Function read_stats_file

crates/cache/src/worker.rs:736–755  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

734}
735
736fn read_stats_file(path: &Path) -> Option<ModuleCacheStatistics> {
737 fs::read_to_string(path)
738 .map_err(|err| {
739 trace!(
740 "Failed to read stats file, path: {}, err: {}",
741 path.display(),
742 err
743 )
744 })
745 .and_then(|contents| {
746 toml::from_str::<ModuleCacheStatistics>(&contents).map_err(|err| {
747 trace!(
748 "Failed to parse stats file, path: {}, err: {}",
749 path.display(),
750 err,
751 )
752 })
753 })
754 .ok()
755}
756
757fn write_stats_file(path: &Path, stats: &ModuleCacheStatistics) -> bool {
758 toml::to_string_pretty(&stats)

Calls 2

read_to_stringFunction · 0.85
okMethod · 0.45