47 releases (21 breaking)

Uses new Rust 2021

0.22.3 Jun 27, 2022
0.22.1 May 29, 2022
0.18.0 Mar 28, 2022
0.14.0 Nov 29, 2021
0.4.0 Nov 10, 2020

#47 in FFI

Download history 236/week @ 2022-04-22 263/week @ 2022-04-29 663/week @ 2022-05-06 1070/week @ 2022-05-13 495/week @ 2022-05-20 720/week @ 2022-05-27 1371/week @ 2022-06-03 502/week @ 2022-06-10 497/week @ 2022-06-17 405/week @ 2022-06-24 390/week @ 2022-07-01 263/week @ 2022-07-08 364/week @ 2022-07-15 680/week @ 2022-07-22 464/week @ 2022-07-29 540/week @ 2022-08-05

2,086 downloads per month
Used in 5 crates (3 directly)

MIT/Apache

63KB
707 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

~1.9–3MB
~60K SLoC