mirror of
https://github.com/topjohnwu/cxx.git
synced 2025-02-24 01:52:27 +00:00
Add test of returning Vec with struct from other bridge
This commit is contained in:
parent
cb6562977a
commit
99b3cb7bc4
@ -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!()
|
||||
|
@ -1,5 +1,9 @@
|
||||
#[cxx::bridge(namespace = "tests")]
|
||||
pub mod ffi {
|
||||
struct Job {
|
||||
raw: u32,
|
||||
}
|
||||
|
||||
unsafe extern "C++" {
|
||||
include!("tests/ffi/tests.h");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user