dtolnay / cxx

Safe interop between Rust and C++
https://cxx.rs
Apache License 2.0
5.87k stars 332 forks source link

Shared structs with type parameters #54

Open dtolnay opened 4 years ago

dtolnay commented 4 years ago

We should support structs that have type parameters and translate them to an ABI-compatible class template in C++.

#[cxx::bridge]
mod ffi {
    struct Generic<T> {
        wow: T,
    }

    extern "C" {
        fn f(g: Generic<String>);
    }
}
dtolnay commented 4 years ago

Marking help wanted, but please only move forward with this if you have a concrete use case for it.