File tree 2 files changed +7
-7
lines changed
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ impl Client {
158
158
159
159
pub fn new_with_config ( url : & str , config : HashMap < String , String > ) -> Result < Self > {
160
160
let parsed_url = Url :: parse ( url) ?;
161
- Self :: with_config ( & parsed_url, Configuration :: from ( config) )
161
+ Self :: with_config ( & parsed_url, Configuration :: new_with_config ( config) ? )
162
162
}
163
163
164
164
fn with_config ( url : & Url , config : Configuration ) -> Result < Self > {
Original file line number Diff line number Diff line change @@ -21,12 +21,6 @@ pub struct Configuration {
21
21
map : HashMap < String , String > ,
22
22
}
23
23
24
- impl From < HashMap < String , String > > for Configuration {
25
- fn from ( conf_map : HashMap < String , String > ) -> Self {
26
- Self { map : conf_map }
27
- }
28
- }
29
-
30
24
impl Configuration {
31
25
pub fn new ( ) -> io:: Result < Self > {
32
26
let mut map: HashMap < String , String > = HashMap :: new ( ) ;
@@ -47,6 +41,12 @@ impl Configuration {
47
41
Ok ( Configuration { map } )
48
42
}
49
43
44
+ pub fn new_with_config ( conf_map : HashMap < String , String > ) -> io:: Result < Self > {
45
+ let mut conf = Self :: new ( ) ?;
46
+ conf. map . extend ( conf_map) ;
47
+ Ok ( conf)
48
+ }
49
+
50
50
/// Get a value from the config, returning None if the key wasn't defined.
51
51
pub fn get ( & self , key : & str ) -> Option < String > {
52
52
self . map . get ( key) . cloned ( )
You can’t perform that action at this time.
0 commit comments