We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Currently only freestanding functions are supported by this crate, not methods.
I like the approach of using self in the foreign function parameter list to signify a method receiver:
self
#[cxx::bridge] mod ffi { extern "C" { type C; fn f(self: &C); } extern "Rust" { type R; fn g(self: &R); } } struct R {...} impl R { fn g(&self) {...} }
This would expose the methods r.g() to C++ and c.f() to Rust.
r.g()
c.f()
The above syntax would require rustc 1.43 or newer for rust-lang/rust#68728.
The text was updated successfully, but these errors were encountered:
Would it make sense to use the &self shorthand instead of self: &C?
&self
self: &C
Sorry, something went wrong.
That would be fine if there is only one extern type in the block.
Implemented in #121.
I filed #124 to follow up on &self and &mut self shorthand inside of extern blocks that contain exactly one extern type.
&mut self
No branches or pull requests
Currently only freestanding functions are supported by this crate, not methods.
I like the approach of using
self
in the foreign function parameter list to signify a method receiver:This would expose the methods
r.g()
to C++ andc.f()
to Rust.The above syntax would require rustc 1.43 or newer for rust-lang/rust#68728.
The text was updated successfully, but these errors were encountered: