52 releases

0.25.0 Mar 9, 2023
0.23.1 Nov 8, 2022
0.22.3 Jun 27, 2022
0.18.0 Mar 28, 2022
0.4.0 Nov 10, 2020

#24 in FFI

Download history 743/week @ 2022-11-28 687/week @ 2022-12-05 761/week @ 2022-12-12 993/week @ 2022-12-19 557/week @ 2022-12-26 335/week @ 2023-01-02 604/week @ 2023-01-09 655/week @ 2023-01-16 832/week @ 2023-01-23 914/week @ 2023-01-30 790/week @ 2023-02-06 1070/week @ 2023-02-13 960/week @ 2023-02-20 801/week @ 2023-02-27 1076/week @ 2023-03-06 691/week @ 2023-03-13

3,580 downloads per month
Used in 11 crates (8 directly)

MIT/Apache

81KB
936 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.3–3.5MB
~70K SLoC