55 releases

0.27.1 Jan 8, 2025
0.27.0 Jun 25, 2024
0.26.0 Jun 16, 2023
0.25.0 Mar 9, 2023
0.4.0 Nov 10, 2020

#17 in FFI

Download history 2884/week @ 2024-09-27 2232/week @ 2024-10-04 2708/week @ 2024-10-11 3204/week @ 2024-10-18 2917/week @ 2024-10-25 2541/week @ 2024-11-01 2835/week @ 2024-11-08 2382/week @ 2024-11-15 2072/week @ 2024-11-22 2069/week @ 2024-11-29 2588/week @ 2024-12-06 2751/week @ 2024-12-13 1517/week @ 2024-12-20 1098/week @ 2024-12-27 1938/week @ 2025-01-03 2064/week @ 2025-01-10

7,070 downloads per month
Used in 42 crates (26 directly)

MIT/Apache

89KB
967 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–7MB
~132K SLoC