Read data from a slab page by ID. Returns the payload bytes. The caller must not hold the reference after calling `free()`.
(&self, id: SlabId)
| 107 | /// Returns the payload bytes. The caller must not hold the reference |
| 108 | /// after calling `free()`. |
| 109 | pub fn read(&self, id: SlabId) -> &[u8] { |
| 110 | assert_eq!(id.core_id, self.core_id, "slab ID core mismatch"); |
| 111 | let offset = id.page_index as usize * self.page_size; |
| 112 | &self.memory[offset..offset + id.len as usize] |
| 113 | } |
| 114 | |
| 115 | /// Free a slab page, returning it to the pool. |
| 116 | pub fn free(&mut self, id: SlabId) { |
no outgoing calls