57 releases (29 breaking)

0.30.0 Mar 3, 2025
0.29.0 Feb 26, 2025
0.27.0 Jun 25, 2024
0.26.0 Jun 16, 2023
0.4.0 Nov 10, 2020

#25 in FFI

Download history 2407/week @ 2025-10-25 3386/week @ 2025-11-01 3797/week @ 2025-11-08 3205/week @ 2025-11-15 2844/week @ 2025-11-22 5031/week @ 2025-11-29 5974/week @ 2025-12-06 5275/week @ 2025-12-13 3793/week @ 2025-12-20 1956/week @ 2025-12-27 5559/week @ 2026-01-03 6119/week @ 2026-01-10 5527/week @ 2026-01-17 6276/week @ 2026-01-24 6530/week @ 2026-01-31 5310/week @ 2026-02-07

24,467 downloads per month
Used in 62 crates (37 directly)

MIT/Apache

89KB
980 lines

Autocxx

GitHub crates.io docs.rs

This project is a tool for calling C++ from Rust in a heavily automated, but safe, fashion.

The intention is that it has all the fluent safety from cxx whilst generating interfaces automatically from existing C++ headers using a variant of bindgen. Think of autocxx as glue which plugs bindgen into cxx.

For full documentation, see the manual.

Overview

autocxx::include_cpp! {
    #include "url/origin.h"
    generate!("url::Origin")
    safety!(unsafe_ffi)
}

fn main() {
    let o = ffi::url::Origin::CreateFromNormalizedTuple("https",
        "google.com", 443);
    let uri = o.Serialize();
    println!("URI is {}", uri.to_str().unwrap());
}

License and usage notes

This is not an officially supported Google product.

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Dependencies

~3.5–6MB
~129K SLoC