Henri started participating in the Mozilla project in 1999 and now works at Mozilla on the Gecko engine. In late 2012, as his first Rust project, he started porting Gecko’s HTML parser, which he wrote, to Rust, but the project was abandoned due to a change in priorities. He returned to Rust post-1.0 to write the encoding_rs crate as a replacement of Gecko’s previous character encoding conversion library.
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.