@@ -39,7 +39,7 @@ impl Category {
39
39
}
40
40
}
41
41
42
- fn required_string_from_toml < ' a > ( toml : & ' a toml:: Table , key : & str ) -> CargoResult < & ' a str > {
42
+ fn required_string_from_toml < ' a > ( toml : & ' a toml:: value :: Table , key : & str ) -> CargoResult < & ' a str > {
43
43
toml. get ( key) . and_then ( toml:: Value :: as_str) . chain_error ( || {
44
44
internal ( & format_args ! (
45
45
"Expected category TOML attribute '{}' to be a String" ,
@@ -48,12 +48,12 @@ fn required_string_from_toml<'a>(toml: &'a toml::Table, key: &str) -> CargoResul
48
48
} )
49
49
}
50
50
51
- fn optional_string_from_toml < ' a > ( toml : & ' a toml:: Table , key : & str ) -> & ' a str {
51
+ fn optional_string_from_toml < ' a > ( toml : & ' a toml:: value :: Table , key : & str ) -> & ' a str {
52
52
toml. get ( key) . and_then ( toml:: Value :: as_str) . unwrap_or ( "" )
53
53
}
54
54
55
55
fn categories_from_toml (
56
- categories : & toml:: Table ,
56
+ categories : & toml:: value :: Table ,
57
57
parent : Option < & Category > ,
58
58
) -> CargoResult < Vec < Category > > {
59
59
let mut result = vec ! [ ] ;
@@ -92,9 +92,8 @@ pub fn sync() -> CargoResult<()> {
92
92
let tx = conn. transaction ( ) . unwrap ( ) ;
93
93
94
94
let categories = include_str ! ( "./categories.toml" ) ;
95
- let toml = toml:: Parser :: new ( categories) . parse ( ) . expect (
96
- "Could not parse categories.toml" ,
97
- ) ;
95
+ let toml: toml:: value:: Table =
96
+ toml:: from_str ( categories) . expect ( "Could not parse categories.toml" ) ;
98
97
99
98
let categories =
100
99
categories_from_toml ( & toml, None ) . expect ( "Could not convert categories from TOML" ) ;
0 commit comments