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

#21 in FFI

Download history 5914/week @ 2024-01-29 7305/week @ 2024-02-05 7607/week @ 2024-02-12 5289/week @ 2024-02-19 11650/week @ 2024-02-26 13178/week @ 2024-03-04 13790/week @ 2024-03-11 10450/week @ 2024-03-18 10428/week @ 2024-03-25 9779/week @ 2024-04-01 13535/week @ 2024-04-08 11928/week @ 2024-04-15 14265/week @ 2024-04-22 11593/week @ 2024-04-29 17605/week @ 2024-05-06 15992/week @ 2024-05-13

59,797 downloads per month
Used in 30 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

~2.5–5MB
~100K SLoC