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
46
47
48
49
50
51
52
53
#[cfg(not(feature = "lifeguard"))]
mod lifeguard;
use std::borrow::Cow;
use std::collections::HashMap;
use primitives::field::Value;
pub trait ParserPool {
fn new_table_hashmap(&mut self, usize) -> HashMap<Cow<'static, str>, Value<'static>>;
fn new_table_entries_vec(&mut self, &[u8]) -> Vec<(&'static str, Value<'static>)>;
fn new_values_vec(&mut self, &[u8]) -> Vec<Value<'static>>;
fn return_table_hashmap(&mut self, _: HashMap<&'static str, &'static str>) {}
fn return_table_entries_vec(&mut self, _: Vec<(&'static str, Value<'static>)>) {}
fn return_values_vec(&mut self, _: Vec<Value<'static>>) {}
}
pub struct NoParserPool;
impl ParserPool for NoParserPool {
fn new_table_hashmap(&mut self, cap: usize) -> HashMap<Cow<'static, str>, Value<'static>> {
HashMap::with_capacity(cap)
}
fn new_values_vec(&mut self, _: &[u8]) -> Vec<Value<'static>> {
Vec::with_capacity(10)
}
fn new_table_entries_vec(&mut self, _: &[u8]) -> Vec<(&'static str, Value<'static>)> {
Vec::with_capacity(10)
}
}