1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#![allow(unused_results)]
use std::collections::HashMap;
use super::*;
#[derive(Debug, Default, Clone)]
pub struct Batch {
pub(crate) writes: HashMap<IVec, Option<IVec>>,
}
impl Batch {
pub fn insert<K, V>(&mut self, key: K, value: V)
where
IVec: From<K> + From<V>,
{
self.writes.insert(IVec::from(key), Some(IVec::from(value)));
}
pub fn remove<K>(&mut self, key: K)
where
IVec: From<K>,
{
self.writes.insert(IVec::from(key), None);
}
}