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

#22 in FFI

Download history 2768/week @ 2025-01-12 2929/week @ 2025-01-19 2425/week @ 2025-01-26 3778/week @ 2025-02-02 4036/week @ 2025-02-09 3087/week @ 2025-02-16 3722/week @ 2025-02-23 4238/week @ 2025-03-02 2782/week @ 2025-03-09 1934/week @ 2025-03-16 1952/week @ 2025-03-23 1905/week @ 2025-03-30 2109/week @ 2025-04-06 1655/week @ 2025-04-13 1608/week @ 2025-04-20 1887/week @ 2025-04-27

7,349 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