(mmap: &memmap2::Mmap, offset: usize)
| 172 | } |
| 173 | |
| 174 | fn read_str(mmap: &memmap2::Mmap, offset: usize) -> String { |
| 175 | let bytes = &mmap[offset..offset + FIELD_LEN]; |
| 176 | let end = bytes.iter().position(|&b| b == 0).unwrap_or(FIELD_LEN); |
| 177 | String::from_utf8_lossy(&bytes[..end]).to_string() |
| 178 | } |
| 179 | |
| 180 | impl MmapReader { |
| 181 | /// Open the global monitor mmap for reading. |