@@ -6,7 +6,7 @@ use miette::{IntoDiagnostic, Result, miette};
66use rats_corim:: CorimBuilder ;
77
88#[ derive( knuffel:: Decode , Debug ) ]
9- struct Measurement {
9+ pub struct Measurement {
1010 #[ knuffel( child, unwrap( argument) ) ]
1111 pub mkey : String ,
1212
@@ -18,7 +18,7 @@ struct Measurement {
1818}
1919
2020#[ derive( knuffel:: Decode , Debug ) ]
21- struct Document {
21+ pub struct Document {
2222 #[ knuffel( child, unwrap( argument) ) ]
2323 pub vendor : String ,
2424
@@ -32,12 +32,17 @@ struct Document {
3232 pub measurements : Vec < Measurement > ,
3333}
3434
35- /// Parse the KDL in from string `kdl`, convert it to an `rats_corim::Corim`
36- /// instance. NOTE: The `name` param should be the name of the file that the
35+ /// Parse the KDL in from string `kdl`
36+ ///
37+ /// NOTE: The `name` param should be the name of the file that the
3738/// `kdl` string was read from. This is used in error reporting.
38- pub fn mock ( name : & str , kdl : & str ) -> Result < Vec < u8 > > {
39- let doc: Document = knuffel:: parse ( name, kdl) ?;
39+ pub fn parse ( name : & str , kdl : & str ) -> Result < Document > {
40+ let doc = knuffel:: parse ( name, kdl) ?;
41+ Ok ( doc)
42+ }
4043
44+ /// Convert `doc` to an `rats_corim::Corim` instance
45+ pub fn mock ( doc : Document ) -> Result < Vec < u8 > > {
4146 let mut corim_builder = CorimBuilder :: new ( ) ;
4247 corim_builder. vendor ( doc. vendor ) ;
4348 corim_builder. tag_id ( doc. tag_id ) ;
0 commit comments