File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ use cxx:: { CxxVector , CxxString } ;
1
2
#[ cxx:: bridge]
2
3
pub mod ffi {
3
4
@@ -17,6 +18,21 @@ pub mod ffi {
17
18
fn translate_vector_of_string ( elements : Vec < String > ) -> & ' static CxxVector < CxxString > ;
18
19
fn get_messages ( ) -> & ' static CxxVector < CxxString > ;
19
20
}
21
+
22
+ extern "Rust" {
23
+ fn print_response ( vec : & CxxVector < CxxString > ) ;
24
+ }
25
+ }
26
+
27
+ fn print_response ( vec : & CxxVector < CxxString > ) {
28
+ let vec: Vec < String > = vec
29
+ . iter ( )
30
+ . map ( |s| s. to_string_lossy ( ) . into_owned ( ) )
31
+ . collect ( ) ;
32
+
33
+ for s in vec {
34
+ println ! ( "{}" , s) ;
35
+ }
20
36
}
21
37
22
38
// To test run "cargo test -- --nocapture"
@@ -76,6 +92,6 @@ mod tests {
76
92
client. verify_model ( ) ;
77
93
78
94
let msgs = ffi:: get_messages ( ) ;
79
- println ! ( "{:?}" , msgs) ;
95
+ print_response ( msgs) ;
80
96
}
81
97
}
You can’t perform that action at this time.
0 commit comments