@@ -2,7 +2,7 @@ use crate::{
22 args:: Fraction ,
33 data_tree:: { DataTree , DataTreeReflection } ,
44 fs_tree_builder:: FsTreeBuilder ,
5- json_data:: JsonData ,
5+ json_data:: { BinaryVersion , JsonData , SchemaVersion , UnitAndTree } ,
66 os_string_display:: OsStringDisplay ,
77 reporter:: ParallelReporter ,
88 runtime_error:: RuntimeError ,
1919 Data : Size + Into < u64 > + Serialize + Send + Sync ,
2020 Report : ParallelReporter < Data > + Sync ,
2121 GetData : Fn ( & Metadata ) -> Data + Copy + Sync ,
22- DataTreeReflection < String , Data > : Into < JsonData > ,
22+ DataTreeReflection < String , Data > : Into < UnitAndTree > ,
2323{
2424 /// List of files and/or directories.
2525 pub files : Vec < PathBuf > ,
4848 Data : Size + Into < u64 > + Serialize + Send + Sync ,
4949 Report : ParallelReporter < Data > + Sync ,
5050 GetData : Fn ( & Metadata ) -> Data + Copy + Sync ,
51- DataTreeReflection < String , Data > : Into < JsonData > ,
51+ DataTreeReflection < String , Data > : Into < UnitAndTree > ,
5252{
5353 /// Run the sub program.
5454 pub fn run ( self ) -> Result < ( ) , RuntimeError > {
@@ -116,11 +116,16 @@ where
116116 } ;
117117
118118 if json_output {
119- let json_data : JsonData = data_tree
119+ let unit_and_tree : UnitAndTree = data_tree
120120 . into_reflection ( ) // I really want to use std::mem::transmute here but can't.
121121 . par_convert_names_to_utf8 ( ) // TODO: allow non-UTF8 somehow.
122122 . expect ( "convert all names from raw string to UTF-8" )
123123 . into ( ) ;
124+ let json_data = JsonData {
125+ schema_version : SchemaVersion ,
126+ binary_version : Some ( BinaryVersion :: current ( ) ) ,
127+ unit_and_tree,
128+ } ;
124129 return serde_json:: to_writer ( stdout ( ) , & json_data)
125130 . map_err ( RuntimeError :: SerializationFailure ) ;
126131 }
0 commit comments