Add a record to the insertion batch.
(&mut self, key: T::Key, value: T::Value)
| 288 | impl<T: Table> InsertionBatch<'_, T> { |
| 289 | /// Add a record to the insertion batch. |
| 290 | pub fn insert(&mut self, key: T::Key, value: T::Value) { |
| 291 | let value = rkyv::to_bytes(&value).unwrap(); |
| 292 | match T::MERGE_OP { |
| 293 | MergeOperator::Default => self.1.put(key.into_raw(), value), |
| 294 | MergeOperator::Associative(_) => self.1.merge(key.into_raw(), value), |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | /// Atomically insert the batch. |
| 299 | pub fn commit(self) { |