Add test of returning Vec with struct from other bridge

This commit is contained in:
David Tolnay 2020-12-04 17:27:40 -08:00
parent cb6562977a
commit 99b3cb7bc4
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 12 additions and 0 deletions

View File

@ -184,7 +184,10 @@ pub mod ffi {
}
extern "C++" {
include!("tests/ffi/module.rs.h");
type COwnedEnum;
type Job = crate::module::ffi::Job;
}
#[repr(u32)]
@ -211,6 +214,7 @@ pub mod ffi {
fn r_return_unique_ptr_string() -> UniquePtr<CxxString>;
fn r_return_rust_vec() -> Vec<u8>;
fn r_return_rust_vec_string() -> Vec<String>;
fn r_return_rust_vec_extern_struct() -> Vec<Job>;
fn r_return_ref_rust_vec(shared: &Shared) -> &Vec<u8>;
fn r_return_mut_rust_vec(shared: &mut Shared) -> &mut Vec<u8>;
fn r_return_identity(_: usize) -> usize;
@ -435,6 +439,10 @@ fn r_return_rust_vec_string() -> Vec<String> {
Vec::new()
}
fn r_return_rust_vec_extern_struct() -> Vec<ffi::Job> {
Vec::new()
}
fn r_return_ref_rust_vec(shared: &ffi::Shared) -> &Vec<u8> {
let _ = shared;
unimplemented!()

View File

@ -1,5 +1,9 @@
#[cxx::bridge(namespace = "tests")]
pub mod ffi {
struct Job {
raw: u32,
}
unsafe extern "C++" {
include!("tests/ffi/tests.h");