cxx icon indicating copy to clipboard operation
cxx copied to clipboard

Support #![cxx::bridge] inner attribute

Open dtolnay opened this issue 4 years ago • 0 comments

A common idiom in my codebase is:

// lib.rs

mod ffi;
/* ... */
// ffi.rs

pub use self::ffi::*;

#[cxx::bridge]
mod ffi {
    /* ... */
}
// whatever.rs

use crate::ffi::Whatever;
/* ... */

It would be convenient for the ffi.rs to be expressible as:

// ffi.rs

#![cxx::bridge]

/* the usual contents of `mod ffi {...}` */

For now this would be blocked on https://github.com/rust-lang/rust/issues/54726.

dtolnay avatar Jul 23 '21 17:07 dtolnay