Reserve appended space and return a mutable slice referring to it.
(&mut self, len: usize)
| 585 | |
| 586 | /// Reserve appended space and return a mutable slice referring to it. |
| 587 | pub fn get_appended_space(&mut self, len: usize) -> &mut [u8] { |
| 588 | let off = self.data.len(); |
| 589 | let new_len = self.data.len() + len; |
| 590 | self.data.resize(new_len, 0); |
| 591 | &mut self.data[off..] |
| 592 | |
| 593 | // Post-invariant: as for `put1()`. |
| 594 | } |
| 595 | |
| 596 | /// Align up to the given alignment. |
| 597 | pub fn align_to(&mut self, align_to: CodeOffset) { |
no test coverage detected