MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / open

Method open

src/executor/memory/module_artifacts.rs:300–309  ·  view source on GitHub ↗
(path: &Path)

Source from the content-addressed store, hash-verified

298
299impl MappedModule {
300 fn open(path: &Path) -> Result<Self> {
301 let file = std::fs::File::open(path)?;
302 // SAFETY: read-only mapping. Replacing the path (the case checked
303 // here) creates a new inode and leaves these bytes untouched. Assumes
304 // modules are not modified or truncated in place while the runner
305 // post-processes, as the walltime unwind data extraction already does.
306 let mmap = unsafe { memmap2::Mmap::map(&file)? };
307 let identity = Self::mapped_identity(&mmap)?;
308 Ok(Self { mmap, identity })
309 }
310
311 fn mapped_identity(mmap: &memmap2::Mmap) -> Result<(u64, u64)> {
312 let start = format!("{:x}-", mmap.as_ptr() as usize);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected