53 releases (25 breaking)

0.26.0 Jun 16, 2023
0.25.0 Mar 9, 2023
0.24.0 Jan 31, 2023
0.23.1 Nov 8, 2022
0.4.0 Nov 10, 2020

#40 in FFI

Download history 3784/week @ 2023-08-09 4092/week @ 2023-08-16 7590/week @ 2023-08-23 4080/week @ 2023-08-30 4883/week @ 2023-09-06 4242/week @ 2023-09-13 5005/week @ 2023-09-20 7548/week @ 2023-09-27 5717/week @ 2023-10-04 13252/week @ 2023-10-11 12293/week @ 2023-10-18 10961/week @ 2023-10-25 9034/week @ 2023-11-01 8258/week @ 2023-11-08 5905/week @ 2023-11-15 6079/week @ 2023-11-22

31,333 downloads per month
Used in 23 crates (15 directly)

MIT/Apache

89KB
965 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–4.5MB
~98K SLoC