1
Fork 0

Make IndexVec::ensure_contains_elem return a reference to the element

This commit is contained in:
Maybe Waffle 2023-04-17 13:14:03 +00:00
parent e49122fb1c
commit e1cd99f6ff
6 changed files with 24 additions and 26 deletions

View file

@ -413,8 +413,8 @@ impl<I: Idx, const N: usize, T: FixedSizeEncoding<ByteArray = [u8; N]>> TableBui
// > Space requirements could perhaps be optimized by using the HAMT `popcnt`
// > trick (i.e. divide things into buckets of 32 or 64 items and then
// > store bit-masks of which item in each bucket is actually serialized).
self.blocks.ensure_contains_elem(i, || [0; N]);
value.write_to_bytes(&mut self.blocks[i]);
let block = self.blocks.ensure_contains_elem(i, || [0; N]);
value.write_to_bytes(block);
}
}