11pub mod package {
22 use serde:: Serialize ;
3- use tucana:: shared:: { DefinitionDataType , FlowType , RuntimeFunctionDefinition } ;
43 use std:: io:: ErrorKind ;
54 use std:: {
65 fs:: { self , DirEntry } ,
76 io:: Error ,
87 path:: Path ,
98 } ;
9+ use tucana:: shared:: { DefinitionDataType , FlowType , RuntimeFunctionDefinition } ;
1010
1111 #[ derive( Serialize , Clone , Debug ) ]
1212 pub struct DefinitionError {
@@ -96,14 +96,16 @@ pub mod package {
9696 fn append_meta ( feature : & mut Feature , meta : & Meta ) {
9797 let definition = meta. definition_string . as_str ( ) ;
9898 match meta. r#type {
99- MetaType :: DataType => match serde_json:: from_str :: < DefinitionDataType > ( definition) {
100- Ok ( data_type) => feature. data_types . push ( data_type) ,
101- Err ( err) => feature. errors . push ( DefinitionError {
102- definition : Parser :: extract_identifier ( definition, MetaType :: DataType ) ,
103- definition_type : MetaType :: DataType ,
104- error : err. to_string ( ) ,
105- } ) ,
106- } ,
99+ MetaType :: DataType => {
100+ match serde_json:: from_str :: < DefinitionDataType > ( definition) {
101+ Ok ( data_type) => feature. data_types . push ( data_type) ,
102+ Err ( err) => feature. errors . push ( DefinitionError {
103+ definition : Parser :: extract_identifier ( definition, MetaType :: DataType ) ,
104+ definition_type : MetaType :: DataType ,
105+ error : err. to_string ( ) ,
106+ } ) ,
107+ }
108+ }
107109 MetaType :: FlowType => match serde_json:: from_str :: < FlowType > ( definition) {
108110 Ok ( flow_type) => feature. flow_types . push ( flow_type) ,
109111 Err ( err) => feature. errors . push ( DefinitionError {
@@ -129,7 +131,6 @@ pub mod package {
129131 }
130132 }
131133
132-
133134 #[ derive( Serialize , Debug , Clone , Copy ) ]
134135 pub enum MetaType {
135136 FlowType ,
@@ -160,7 +161,11 @@ pub mod package {
160161 }
161162
162163 impl Meta {
163- pub fn read_from_file < P > ( name : String , r#type : MetaType , file_path : P ) -> Result < Meta , Error >
164+ pub fn read_from_file < P > (
165+ name : String ,
166+ r#type : MetaType ,
167+ file_path : P ,
168+ ) -> Result < Meta , Error >
164169 where
165170 P : AsRef < Path > ,
166171 {
@@ -292,6 +297,4 @@ pub mod package {
292297 . to_str ( )
293298 . map ( |file_name| file_name. to_string ( ) )
294299 }
295-
296-
297- }
300+ }
0 commit comments