A Rust Crate that also quacks like a modern C++ Library

Henri Sivonen

Playlists: 'rustfest18' videos starting here / audio / related events

In Firefox 56, the encoding_rs character encoding conversion crate replaced Firefox’s previous encoding conversion library that was written in C++. This talk examines the API design characteristics that allowed the Rust API of encoding_rs to be mapped to an idiomatic C API and how it was possible to re-create an almost exact modern C++ analog of the Rust API on top of the C API. Rather than trying to cover the mapping of an arbitrary Rust API to C++, this talk focuses on patterns that are easy to map to C++ to help others to aim for such patterns when bringing Rust to C++ code bases.