(&self)
| 44 | |
| 45 | #[inline(always)] |
| 46 | fn allocate_chunk(&self) -> Result<Box<[u8]>, crate::Trap> { |
| 47 | let mut chunk = Vec::new(); |
| 48 | match chunk.try_reserve_exact(self.chunk_size) { |
| 49 | Ok(()) => {} |
| 50 | Err(_) => { |
| 51 | cold_path(); |
| 52 | return Err(crate::Trap::OutOfMemory); |
| 53 | } |
| 54 | } |
| 55 | chunk.resize(self.chunk_size, 0); |
| 56 | Ok(chunk.into_boxed_slice()) |
| 57 | } |
| 58 | |
| 59 | #[inline(always)] |
| 60 | fn chunk_mut(&mut self, chunk_idx: usize) -> Result<&mut [u8], crate::Trap> { |