cxx icon indicating copy to clipboard operation
cxx copied to clipboard

Are associated functions supported?

Open saschanaz opened this issue 4 years ago • 0 comments

For example:

struct Foo {};
impl Foo {
  fn foo() -> u16;
}

#[cxx::bridge]
mod ffi {
    extern "Rust" {
        type Foo;

        // How can I indicate this is `Foo::foo()`?
        fn foo() -> u16; // Error: cannot find function `foo` in module `super`
    }
}

If this is supported, I guess adding an example here would be very helpful.

(Note that the example lacks &self).

saschanaz avatar Jun 20 '21 17:06 saschanaz