File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ impl toml_test_harness::Decoder for Decoder {
1111 fn decode ( & self , data : & [ u8 ] ) -> Result < toml_test_harness:: Decoded , toml_test_harness:: Error > {
1212 let data = std:: str:: from_utf8 ( data) . map_err ( toml_test_harness:: Error :: new) ?;
1313 let document = data
14- . parse :: < toml:: Value > ( )
14+ . parse :: < toml:: Table > ( )
1515 . map_err ( toml_test_harness:: Error :: new) ?;
16- value_to_decoded ( & document)
16+ let value = toml:: Value :: Table ( document) ;
17+ value_to_decoded ( & value)
1718 }
1819}
1920
Original file line number Diff line number Diff line change @@ -10,7 +10,10 @@ impl toml_test_harness::Encoder for Encoder {
1010
1111 fn encode ( & self , data : toml_test_harness:: Decoded ) -> Result < String , toml_test_harness:: Error > {
1212 let value = from_decoded ( & data) ?;
13- let s = toml:: to_string ( & value) . map_err ( toml_test_harness:: Error :: new) ?;
13+ let toml:: Value :: Table ( document) = value else {
14+ return Err ( toml_test_harness:: Error :: new ( "no root table" ) ) ;
15+ } ;
16+ let s = toml:: to_string ( & document) . map_err ( toml_test_harness:: Error :: new) ?;
1417 Ok ( s)
1518 }
1619}
You can’t perform that action at this time.
0 commit comments