From eb3a89df1068f5cd36b02ebe8a3ce2a163dadf53 Mon Sep 17 00:00:00 2001 From: al8n Date: Wed, 2 Oct 2024 05:08:46 +0800 Subject: [PATCH] fmt --- src/swmr/generic.rs | 128 +++++++++++++++++++++++--------------------- 1 file changed, 68 insertions(+), 60 deletions(-) diff --git a/src/swmr/generic.rs b/src/swmr/generic.rs index 91e9779a..f410ec30 100644 --- a/src/swmr/generic.rs +++ b/src/swmr/generic.rs @@ -1111,21 +1111,23 @@ where B: BatchWithKeyBuilder, Value = Generic<'a, V>>, { unsafe { - process_batch!(self( - batch, - |ptr, ent: &EntryWithKeyBuilder, _>| { - let f = ent.kb.builder(); - f(&mut VacantBuffer::new( - ent.meta.vlen, - NonNull::new_unchecked(ptr), - )) - .map_err(Among::Left) - }, - |ptr, ent: &EntryWithKeyBuilder, _>| { - let value_buf = slice::from_raw_parts_mut(ptr, ent.meta.vlen); - ent.value.encode(value_buf).map_err(Among::Middle) - } - )) + process_batch! { + self( + batch, + |ptr, ent: &EntryWithKeyBuilder, _>| { + let f = ent.kb.builder(); + f(&mut VacantBuffer::new( + ent.meta.vlen, + NonNull::new_unchecked(ptr), + )) + .map_err(Among::Left) + }, + |ptr, ent: &EntryWithKeyBuilder, _>| { + let value_buf = slice::from_raw_parts_mut(ptr, ent.meta.vlen); + ent.value.encode(value_buf).map_err(Among::Middle) + } + ) + } } } @@ -1138,21 +1140,23 @@ where B: BatchWithValueBuilder, Key = Generic<'a, K>>, { unsafe { - process_batch!(self( - batch, - |ptr, ent: &EntryWithValueBuilder, B::ValueBuilder, _>| { - let key_buf = slice::from_raw_parts_mut(ptr, ent.meta.klen); - ent.key.encode(key_buf).map_err(Among::Left) - }, - |ptr, ent: &EntryWithValueBuilder, B::ValueBuilder, _>| { - let f = ent.vb.builder(); - f(&mut VacantBuffer::new( - ent.meta.vlen, - NonNull::new_unchecked(ptr), - )) - .map_err(Among::Middle) - } - )) + process_batch! { + self( + batch, + |ptr, ent: &EntryWithValueBuilder, B::ValueBuilder, _>| { + let key_buf = slice::from_raw_parts_mut(ptr, ent.meta.klen); + ent.key.encode(key_buf).map_err(Among::Left) + }, + |ptr, ent: &EntryWithValueBuilder, B::ValueBuilder, _>| { + let f = ent.vb.builder(); + f(&mut VacantBuffer::new( + ent.meta.vlen, + NonNull::new_unchecked(ptr), + )) + .map_err(Among::Middle) + } + ) + } } } @@ -1165,25 +1169,27 @@ where B: BatchWithBuilders>, { unsafe { - process_batch!(self( - batch, - |ptr, ent: &EntryWithBuilders| { - let f = ent.kb.builder(); - f(&mut VacantBuffer::new( - ent.meta.klen, - NonNull::new_unchecked(ptr), - )) - .map_err(Among::Left) - }, - |ptr, ent: &EntryWithBuilders| { - let f = ent.vb.builder(); - f(&mut VacantBuffer::new( - ent.meta.vlen, - NonNull::new_unchecked(ptr), - )) - .map_err(Among::Middle) - } - )) + process_batch! { + self( + batch, + |ptr, ent: &EntryWithBuilders| { + let f = ent.kb.builder(); + f(&mut VacantBuffer::new( + ent.meta.klen, + NonNull::new_unchecked(ptr), + )) + .map_err(Among::Left) + }, + |ptr, ent: &EntryWithBuilders| { + let f = ent.vb.builder(); + f(&mut VacantBuffer::new( + ent.meta.vlen, + NonNull::new_unchecked(ptr), + )) + .map_err(Among::Middle) + } + ) + } } } @@ -1193,17 +1199,19 @@ where batch: &'b mut B, ) -> Result<(), Among> { unsafe { - process_batch!(self( - batch, - |ptr, ent: &GenericEntry<'_, K, V>| { - let key_buf = slice::from_raw_parts_mut(ptr, ent.meta.klen); - ent.key.encode(key_buf).map_err(Among::Left) - }, - |ptr, ent: &GenericEntry<'_, K, V>| { - let value_buf = slice::from_raw_parts_mut(ptr, ent.meta.vlen); - ent.value.encode(value_buf).map_err(Among::Middle) - } - )) + process_batch! { + self( + batch, + |ptr, ent: &GenericEntry<'_, K, V>| { + let key_buf = slice::from_raw_parts_mut(ptr, ent.meta.klen); + ent.key.encode(key_buf).map_err(Among::Left) + }, + |ptr, ent: &GenericEntry<'_, K, V>| { + let value_buf = slice::from_raw_parts_mut(ptr, ent.meta.vlen); + ent.value.encode(value_buf).map_err(Among::Middle) + } + ) + } } }