Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed Oct 1, 2024
1 parent a917088 commit eb3a89d
Showing 1 changed file with 68 additions and 60 deletions.
128 changes: 68 additions & 60 deletions src/swmr/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1111,21 +1111,23 @@ where
B: BatchWithKeyBuilder<GenericPointer<K, V>, Value = Generic<'a, V>>,
{
unsafe {
process_batch!(self(
batch,
|ptr, ent: &EntryWithKeyBuilder<B::KeyBuilder, Generic<'_, V>, _>| {
let f = ent.kb.builder();
f(&mut VacantBuffer::new(
ent.meta.vlen,
NonNull::new_unchecked(ptr),
))
.map_err(Among::Left)
},
|ptr, ent: &EntryWithKeyBuilder<B::KeyBuilder, Generic<'_, 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: &EntryWithKeyBuilder<B::KeyBuilder, Generic<'_, V>, _>| {
let f = ent.kb.builder();
f(&mut VacantBuffer::new(
ent.meta.vlen,
NonNull::new_unchecked(ptr),

Check warning on line 1121 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1114-L1121

Added lines #L1114 - L1121 were not covered by tests
))
.map_err(Among::Left)

Check warning on line 1123 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1123

Added line #L1123 was not covered by tests
},
|ptr, ent: &EntryWithKeyBuilder<B::KeyBuilder, Generic<'_, V>, _>| {
let value_buf = slice::from_raw_parts_mut(ptr, ent.meta.vlen);
ent.value.encode(value_buf).map_err(Among::Middle)

Check warning on line 1127 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1125-L1127

Added lines #L1125 - L1127 were not covered by tests
}
)
}
}
}

Expand All @@ -1138,21 +1140,23 @@ where
B: BatchWithValueBuilder<GenericPointer<K, V>, Key = Generic<'a, K>>,
{
unsafe {
process_batch!(self(
batch,
|ptr, ent: &EntryWithValueBuilder<Generic<'_, K>, 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<Generic<'_, K>, 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<Generic<'_, K>, B::ValueBuilder, _>| {
let key_buf = slice::from_raw_parts_mut(ptr, ent.meta.klen);
ent.key.encode(key_buf).map_err(Among::Left)

Check warning on line 1148 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1143-L1148

Added lines #L1143 - L1148 were not covered by tests
},
|ptr, ent: &EntryWithValueBuilder<Generic<'_, K>, B::ValueBuilder, _>| {
let f = ent.vb.builder();
f(&mut VacantBuffer::new(
ent.meta.vlen,
NonNull::new_unchecked(ptr),

Check warning on line 1154 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1150-L1154

Added lines #L1150 - L1154 were not covered by tests
))
.map_err(Among::Middle)

Check warning on line 1156 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1156

Added line #L1156 was not covered by tests
}
)
}
}
}

Expand All @@ -1165,25 +1169,27 @@ where
B: BatchWithBuilders<GenericPointer<K, V>>,
{
unsafe {
process_batch!(self(
batch,
|ptr, ent: &EntryWithBuilders<B::KeyBuilder, B::ValueBuilder, _>| {
let f = ent.kb.builder();
f(&mut VacantBuffer::new(
ent.meta.klen,
NonNull::new_unchecked(ptr),
))
.map_err(Among::Left)
},
|ptr, ent: &EntryWithBuilders<B::KeyBuilder, 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: &EntryWithBuilders<B::KeyBuilder, B::ValueBuilder, _>| {
let f = ent.kb.builder();
f(&mut VacantBuffer::new(
ent.meta.klen,
NonNull::new_unchecked(ptr),

Check warning on line 1179 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1172-L1179

Added lines #L1172 - L1179 were not covered by tests
))
.map_err(Among::Left)

Check warning on line 1181 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1181

Added line #L1181 was not covered by tests
},
|ptr, ent: &EntryWithBuilders<B::KeyBuilder, B::ValueBuilder, _>| {
let f = ent.vb.builder();
f(&mut VacantBuffer::new(
ent.meta.vlen,
NonNull::new_unchecked(ptr),

Check warning on line 1187 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1183-L1187

Added lines #L1183 - L1187 were not covered by tests
))
.map_err(Among::Middle)

Check warning on line 1189 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1189

Added line #L1189 was not covered by tests
}
)
}
}
}

Expand All @@ -1193,17 +1199,19 @@ where
batch: &'b mut B,
) -> Result<(), Among<K::Error, V::Error, Error>> {
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)

Check warning on line 1207 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1203-L1207

Added lines #L1203 - L1207 were not covered by tests
},
|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)

Check warning on line 1211 in src/swmr/generic.rs

View check run for this annotation

Codecov / codecov/patch

src/swmr/generic.rs#L1209-L1211

Added lines #L1209 - L1211 were not covered by tests
}
)
}
}
}

Expand Down

0 comments on commit eb3a89d

Please sign in to comment.