Need help with rustcxx?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

477 Stars 21 Forks Apache License 2.0 9 Commits 2 Opened issues


rustcxx: Using C++ from Rust made easy

Services available


Need anything else?

Contributors list

rustcxx: Using C++ from Rust made easy

rustcxx is a tool allowing C++ to be used from a Rust project easily. It works by allowing snippets of C++ to be included within a Rust function, and vice-versa.



cxx_inline! { #include <stdint.h> uint32_t square_it(uint32_t x) { return rust![(x: u32) -> u32 { println!("Rust: Squaring {}", x); x * x }]; } }

let x: u32 = 5; let square = unsafe { cxx![(x: u32) -> u32 { std::cout << "C++: Squaring " << x << std::endl; square_it(x) }] }; </stdint.h>

See the provided example for more details.


rustcxx requires a nightly version of the Rust compiler.

Add to your

: ```toml [package] build = ""

[dependencies.rustcxx_plugin] git = "" branch = "unstable"

[build-dependencies.rustcxx_codegen] git = "" branch = "unstable" ```

and create a
file containing the following:
extern crate rustcxx_codegen;

fn main() { rustcxx_codegen::build("src/"); }


The main author is Paul Liétar.


We gladly accept contributions via GitHub pull requests, as long as the author has signed the Google Contributor License. Please see for more details.


This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.