make write_with forward return values, use it to correct partial string handling

This commit is contained in:
Mark Thom
2025-03-15 02:10:56 -07:00
committed by Mark Thom
parent 2ad870c740
commit eef7b06919
3 changed files with 79 additions and 70 deletions

View File

@@ -289,10 +289,13 @@ impl Ball {
while pstr_threshold < heap_index!(self.stub.cell_len()) {
let HeapStringScan { string, tail_idx } = self.stub.scan_slice_to_str(pstr_threshold);
pstr_threshold += dest_writer.write_with(|section| {
section.push_pstr(string).unwrap();
section.push_cell(self.stub[tail_idx] - diff);
});
pstr_threshold += dest_writer
.write_with(|section| {
if section.push_pstr(string).is_some() {
section.push_cell(self.stub[tail_idx] - diff);
}
})
.bytes_written;
}
Ok(h)