@@ -16,6 +16,7 @@ mod send;
1616#[ derive( Clone ) ]
1717pub struct Client {
1818 pub location : String ,
19+ pub options : Rc < Options > ,
1920
2021 pub ser : Ser ,
2122 pub des : Des ,
@@ -24,6 +25,7 @@ pub struct Client {
2425impl Default for Client {
2526 fn default ( ) -> Self {
2627 let location = "result" . to_string ( ) ;
28+ let options = Rc :: new ( Options :: default ( ) ) ;
2729
2830 let ser = Ser {
2931 options : Rc :: new ( Options :: default ( ) ) ,
@@ -36,7 +38,12 @@ impl Default for Client {
3638 check : false ,
3739 } ;
3840
39- Client { location, ser, des }
41+ Client {
42+ location,
43+ options,
44+ ser,
45+ des,
46+ }
4047 }
4148}
4249
@@ -63,20 +70,27 @@ impl Client {
6370 }
6471
6572 fn child ( & self , options : & Rc < Options > , name : & str ) -> Self {
73+ let options = Rc :: clone ( options) ;
74+
6675 let mut ser = self . ser . clone ( ) ;
67- ser. options = Rc :: clone ( options) ;
76+ ser. options = Rc :: clone ( & options) ;
6877
6978 let mut des = self . des . clone ( ) ;
70- des. options = Rc :: clone ( options) ;
79+ des. options = Rc :: clone ( & options) ;
7180
7281 Client {
7382 location : self . location . clone ( ) + "." + name,
83+ options,
7484
7585 ser,
7686 des,
7787 }
7888 }
7989
90+ fn name ( & self , words : & ' static str ) -> String {
91+ self . options . casing ( ) . fmt ( words)
92+ }
93+
8094 fn export ( & self , b : & mut Builder , name : & str , expr : impl Into < Expr > ) {
8195 let expr = expr. into ( ) ;
8296 let location = & self . location ;
0 commit comments