This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree 1 file changed +15
-42
lines changed
1 file changed +15
-42
lines changed Original file line number Diff line number Diff line change 1
- use std:: {
2
- fs:: File ,
3
- io:: { self , Write } ,
4
- process:: Command ,
5
- } ;
6
-
7
- #[ derive( Debug ) ]
8
- struct Pipe < ' a > {
9
- data : & ' a str ,
10
- ptr : File ,
1
+ [ var]
2
+ python ! {
3
+ print( var)
11
4
}
12
5
13
- impl < ' a > Pipe < ' a > {
14
- fn new ( data : & ' a str ) -> std:: io:: Result < Self > {
15
- Ok ( Pipe {
16
- data,
17
- ptr : File :: create ( "examples/demo/src/pipe.json" ) ?,
18
- } )
19
- }
20
-
21
- fn send ( & mut self ) -> io:: Result < usize > {
22
- Ok ( self . ptr . write ( self . data . as_bytes ( ) ) ?)
6
+ [ one, two, three] -> [ scooped]
7
+ rust ! {
8
+ println!( "It's A me! mArio!" ) ;
9
+ let scooped = "RUST STRING" ;
10
+ {
11
+ println!( "inside block" ) ;
23
12
}
24
13
}
25
14
26
- fn main ( ) -> io :: Result < ( ) > {
27
- println ! ( "--------------- RUST ---------------" ) ;
28
- let mut data = Pipe :: new (
29
- r#"
30
- {
31
- "data": "(main.rs) Sent from rust."
15
+ [ scooped ]
16
+ c ! {
17
+ printf ( "Hello, World!" ) ;
18
+ { } ,
19
+ printf ( "%s" , scooped ) ;
20
+ char * scooped = "C STRING" ;
32
21
}
33
- "# ,
34
- ) ?;
35
22
36
- println ! ( "From Rust: {:#?}" , data) ;
37
- println ! ( "Sending..." ) ;
38
- data. send ( ) ?;
39
- println ! ( "Sent!" ) ;
40
-
41
- Command :: new ( "python" )
42
- . arg ( "examples/demo/src/pipe.py" )
43
- . spawn ( )
44
- . expect ( "Couldn't run python. Make Sure you've installed it." ) ;
45
-
46
- println ! ( "------------- END RUST -------------" ) ;
47
- println ! ( ) ;
48
- Ok ( ( ) )
49
- }
You can’t perform that action at this time.
0 commit comments