File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -112,17 +112,14 @@ enum MatchResult {
112
112
Unmatched ,
113
113
}
114
114
115
- impl FromStr for RegistryHandler {
116
- type Err = anyhow:: Error ;
117
-
118
- fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
119
- let mut config: Config = toml:: from_str ( s) ?;
115
+ impl RegistryHandler {
116
+ pub fn from_vec ( s : Vec < u8 > ) -> Result < Self > {
117
+ let registry_configuration = String :: from_utf8 ( s) ?;
118
+ let mut config: Config = toml:: from_str ( & registry_configuration) ?;
120
119
config. validate_and_tidy ( ) ?;
121
120
Ok ( Self { config } )
122
121
}
123
- }
124
122
125
- impl RegistryHandler {
126
123
fn generate_unqualified_search_tasks ( & self , reference : & Reference ) -> Vec < ImagePullTask > {
127
124
let mut tasks = Vec :: new ( ) ;
128
125
@@ -371,7 +368,7 @@ location = "docker.io"
371
368
location = "123456.mirror.aliyuncs.com"
372
369
"# ;
373
370
374
- RegistryHandler :: from_str ( config) . unwrap ( )
371
+ RegistryHandler :: from_vec ( config. as_bytes ( ) . to_vec ( ) ) . unwrap ( )
375
372
}
376
373
377
374
#[ test]
You can’t perform that action at this time.
0 commit comments