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

#23 in FFI

Download history 2627/week @ 2025-01-17 2580/week @ 2025-01-24 3605/week @ 2025-01-31 4242/week @ 2025-02-07 3011/week @ 2025-02-14 3551/week @ 2025-02-21 4232/week @ 2025-02-28 3328/week @ 2025-03-07 2047/week @ 2025-03-14 1896/week @ 2025-03-21 1901/week @ 2025-03-28 1987/week @ 2025-04-04 1934/week @ 2025-04-11 1408/week @ 2025-04-18 1993/week @ 2025-04-25 1615/week @ 2025-05-02

7,255 downloads per month
Used in 49 crates (29 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

~2.6–6MB
~108K SLoC