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

#50 in FFI

Download history 8996/week @ 2024-01-07 7921/week @ 2024-01-14 6792/week @ 2024-01-21 5888/week @ 2024-01-28 7271/week @ 2024-02-04 7606/week @ 2024-02-11 5319/week @ 2024-02-18 11642/week @ 2024-02-25 13114/week @ 2024-03-03 13639/week @ 2024-03-10 10480/week @ 2024-03-17 10578/week @ 2024-03-24 9767/week @ 2024-03-31 13515/week @ 2024-04-07 11719/week @ 2024-04-14 13296/week @ 2024-04-21

49,341 downloads per month
Used in 29 crates (19 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

~3.5–5.5MB
~116K SLoC