1+ use code0_definition_reader:: parser:: Parser ;
2+ use prost:: Message ;
13use std:: fs;
24use std:: io:: Write ;
3- use prost:: Message ;
4- use code0_definition_reader:: parser:: Parser ;
55
66pub fn bundle ( path : Option < String > , out : Option < String > ) {
77 let dir_path = path. unwrap_or_else ( || "./definitions" . to_string ( ) ) ;
@@ -24,25 +24,52 @@ pub fn bundle(path: Option<String>, out: Option<String>) {
2424 feature. data_types . iter ( ) . for_each ( |data_type| {
2525 let mut buf = Vec :: new ( ) ;
2626 if let Ok ( _) = data_type. encode ( & mut buf) {
27- let path = format ! ( "{}/{}_{}_{}.pb" , & out_path, feature. name, "data_type" , data_type. identifier. to_lowercase( ) ) ;
28- fs:: File :: create ( & path) . expect ( "abc" ) . write_all ( & buf) . expect ( "a" ) ;
27+ let path = format ! (
28+ "{}/{}_{}_{}.pb" ,
29+ & out_path,
30+ feature. name,
31+ "data_type" ,
32+ data_type. identifier. to_lowercase( )
33+ ) ;
34+ fs:: File :: create ( & path)
35+ . expect ( "abc" )
36+ . write_all ( & buf)
37+ . expect ( "a" ) ;
2938 }
3039 } ) ;
3140
3241 feature. flow_types . iter ( ) . for_each ( |flow_type| {
3342 let mut buf = Vec :: new ( ) ;
3443 if let Ok ( _) = flow_type. encode ( & mut buf) {
35- let path = format ! ( "{}/{}_{}_{}.pb" , & out_path, feature. name, "flow_type" , flow_type. identifier. to_lowercase( ) ) ;
36- fs:: File :: create ( & path) . expect ( "abc" ) . write_all ( & buf) . expect ( "a" ) ;
44+ let path = format ! (
45+ "{}/{}_{}_{}.pb" ,
46+ & out_path,
47+ feature. name,
48+ "flow_type" ,
49+ flow_type. identifier. to_lowercase( )
50+ ) ;
51+ fs:: File :: create ( & path)
52+ . expect ( "abc" )
53+ . write_all ( & buf)
54+ . expect ( "a" ) ;
3755 }
3856 } ) ;
3957
4058 feature. runtime_functions . iter ( ) . for_each ( |function| {
4159 let mut buf = Vec :: new ( ) ;
4260 if let Ok ( _) = function. encode ( & mut buf) {
43- let path = format ! ( "{}/{}_{}_{}.pb" , & out_path, feature. name, "function" , function. runtime_name. to_lowercase( ) ) ;
44- fs:: File :: create ( & path) . expect ( "abc" ) . write_all ( & buf) . expect ( "a" ) ;
61+ let path = format ! (
62+ "{}/{}_{}_{}.pb" ,
63+ & out_path,
64+ feature. name,
65+ "function" ,
66+ function. runtime_name. to_lowercase( )
67+ ) ;
68+ fs:: File :: create ( & path)
69+ . expect ( "abc" )
70+ . write_all ( & buf)
71+ . expect ( "a" ) ;
4572 }
4673 } ) ;
4774 }
48- }
75+ }
0 commit comments