Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/google/autocxx

Tool for safe ergonomic Rust/C++ interop driven from existing C++ headers
https://github.com/google/autocxx

bindgen cxx rust

Last synced: 5 days ago
JSON representation

Tool for safe ergonomic Rust/C++ interop driven from existing C++ headers

Awesome Lists containing this project

README

        

# Autocxx

[![GitHub](https://img.shields.io/crates/l/autocxx)](https://github.com/google/autocxx)
[![crates.io](https://img.shields.io/crates/d/autocxx)](https://crates.io/crates/autocxx)
[![docs.rs](https://docs.rs/autocxx/badge.svg)](https://docs.rs/autocxx)

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](https://cxx.rs) whilst generating interfaces automatically from existing C++ headers using a variant of [bindgen](https://docs.rs/bindgen/latest/bindgen/). Think of autocxx as glue which plugs bindgen into cxx.

For full documentation, see [the manual](https://google.github.io/autocxx/).

# Overview

```rust,ignore
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.