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

#38 in FFI

Download history 2286/week @ 2024-11-20 2157/week @ 2024-11-27 2324/week @ 2024-12-04 2704/week @ 2024-12-11 2193/week @ 2024-12-18 1029/week @ 2024-12-25 1525/week @ 2025-01-01 2444/week @ 2025-01-08 2464/week @ 2025-01-15 2939/week @ 2025-01-22 2843/week @ 2025-01-29 3883/week @ 2025-02-05 3612/week @ 2025-02-12 3609/week @ 2025-02-19 4007/week @ 2025-02-26 3808/week @ 2025-03-05

15,550 downloads per month
Used in 47 crates (27 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.5–6MB
~109K SLoC