55 releases

0.27.1 Jan 8, 2025
0.27.0 Jun 25, 2024
0.26.0 Jun 16, 2023
0.25.0 Mar 9, 2023
0.4.0 Nov 10, 2020

#17 in FFI

Download history 3481/week @ 2024-10-21 2587/week @ 2024-10-28 2832/week @ 2024-11-04 2570/week @ 2024-11-11 2334/week @ 2024-11-18 2177/week @ 2024-11-25 1972/week @ 2024-12-02 2998/week @ 2024-12-09 2412/week @ 2024-12-16 1260/week @ 2024-12-23 1209/week @ 2024-12-30 2032/week @ 2025-01-06 2824/week @ 2025-01-13 2995/week @ 2025-01-20 2300/week @ 2025-01-27 3596/week @ 2025-02-03

11,858 downloads per month
Used in 45 crates (27 directly)

MIT/Apache

89KB
967 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–7MB
~132K SLoC