Update the object crate to 0.27.0 (#3465)

Mostly just keeping us up to date with changes there since we somewhat
heavily rely on it now.
This commit is contained in:
Alex Crichton
2021-10-20 10:52:06 -05:00
committed by GitHub
parent fe4b15c8b0
commit e2a724ce18
12 changed files with 25 additions and 29 deletions

View File

@@ -195,17 +195,13 @@ impl WritableBuffer for ObjectMmap {
Ok(())
}
fn resize(&mut self, new_len: usize, value: u8) {
fn resize(&mut self, new_len: usize) {
// Resizing always appends 0 bytes and since new mmaps start out as 0
// bytes we don't actually need to do anything as part of this other
// than update our own length.
if new_len <= self.len {
return;
}
let mmap = self.mmap.as_mut().expect("write before reserve");
// new mmaps are automatically filled with zeros, so if we're asked to
// fill with zeros then we can skip the actual fill step.
if value != 0 {
mmap[self.len..][..new_len - self.len].fill(value);
}
self.len = new_len;
}