(&self, offset: u64, size: usize)
| 206 | #[cfg(unix)] |
| 207 | #[inline] |
| 208 | fn read_bytes(&self, offset: u64, size: usize) -> Vec<u8> { |
| 209 | let mut buf = Vec::with_capacity(size); |
| 210 | unsafe { |
| 211 | std::ptr::copy_nonoverlapping( |
| 212 | self.mmap_ptr.add(offset as usize), |
| 213 | buf.as_mut_ptr(), |
| 214 | size, |
| 215 | ); |
| 216 | buf.set_len(size); |
| 217 | } |
| 218 | buf |
| 219 | } |
| 220 | |
| 221 | /// Get a zero-copy slice into the mmap'd region. |
| 222 | #[cfg(unix)] |
no test coverage detected