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
33
34
35
36
37
38
39
40
41
42
43
44
45
use std::slice::Iter;
#[derive(Debug)]
pub struct FLUSHDB {
pub _async: Option<bool>
}
pub(crate) fn parse_flushdb(mut iter: Iter<Vec<u8>>) -> FLUSHDB {
let mut _async = None;
if let Some(next_arg) = iter.next() {
let arg_upper = String::from_utf8_lossy(next_arg).to_uppercase();
if &arg_upper == "ASYNC" {
_async = Some(true);
} else {
panic!("Invalid argument")
}
}
FLUSHDB { _async }
}
#[derive(Debug)]
pub struct FLUSHALL {
pub _async: Option<bool>
}
pub(crate) fn parse_flushall(mut iter: Iter<Vec<u8>>) -> FLUSHALL {
let mut _async = None;
if let Some(next_arg) = iter.next() {
let arg_upper = String::from_utf8_lossy(next_arg).to_uppercase();
if &arg_upper == "ASYNC" {
_async = Some(true);
} else {
panic!("Invalid argument")
}
}
FLUSHALL { _async }
}