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
use std::{
collections::HashMap,
ops::{Deref, DerefMut},
};
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct Parameters(pub HashMap<String, String>);
impl Parameters {
pub fn empty() -> Self {
Self(HashMap::new())
}
pub fn insert(
&mut self,
key: impl Into<String>,
value: impl ToString,
) -> &mut Self {
self.0.insert(key.into(), value.to_string());
self
}
}
impl Deref for Parameters {
type Target = HashMap<String, String>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for Parameters {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}