File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ /target
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " cautocfg"
3
+ version = " 0.1.0"
4
+ edition = " 2018"
5
+
6
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
+
8
+ [dependencies ]
Original file line number Diff line number Diff line change
1
+
2
+ use std:: fs:: File ;
3
+ use std:: io:: LineWriter ;
4
+
5
+ struct AutoCfg {
6
+ config_dir : & str
7
+ }
8
+
9
+ impl AutoCfg {
10
+
11
+ fn new ( ) -> AutoCfg {
12
+ AutoCfg {
13
+ config_dir : "." ,
14
+ }
15
+ }
16
+
17
+ fn write ( & self ) -> Result < ( ) > {
18
+
19
+ let mut stream = File :: create ( self . config_dir ) ;
20
+
21
+ let mut output = LineWriter :: new ( stream) ;
22
+
23
+ output. write_all ( "#define FOO_BAR_H 1\n " ) ;
24
+
25
+ output. write_all ( format ! ( "#define PACKAGE_NAME \" {}\" \n " , "example" ) ) ;
26
+
27
+ output. write_all ( format ! ( "#define VERSION \" {}\" \n " , "1.0.0" ) ) ;
28
+
29
+ let _status = output. flush ( ) ;
30
+
31
+ Ok ( ( ) )
32
+ }
33
+
34
+ }
You can’t perform that action at this time.
0 commit comments