perf(db): reduce different repeated allocations (#2103)

This commit is contained in:
joshieDo
2023-04-13 23:33:53 +08:00
committed by GitHub
parent 2f003bf8ae
commit 019ddd1edc
32 changed files with 358 additions and 181 deletions

View File

@ -249,7 +249,7 @@ mod tests {
fuzz_test_test_struct(TestStruct::default())
}
impl Compact for TestStruct {
fn to_compact(self, buf: &mut impl bytes::BufMut) -> usize {
fn to_compact<B>(self, buf: &mut B) -> usize where B: bytes::BufMut + AsMut<[u8]> {
let mut flags = TestStructFlags::default();
let mut total_len = 0;
let mut buffer = bytes::BytesMut::new();