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
32
use std::slice::Iter;
#[derive(Debug)]
pub struct SELECT {
pub db: i32,
}
pub(crate) fn parse_select(mut iter: Iter<Vec<u8>>) -> SELECT {
let db = String::from_utf8_lossy(iter.next().unwrap());
let db = db.parse::<i32>().unwrap();
SELECT { db }
}
#[derive(Debug)]
pub struct SWAPDB<'a> {
pub index1: &'a [u8],
pub index2: &'a [u8],
}
pub(crate) fn parse_swapdb(mut iter: Iter<Vec<u8>>) -> SWAPDB {
let index1 = iter.next().unwrap();
let index2 = iter.next().unwrap();
SWAPDB { index1, index2 }
}