C→Rust, Beyond the Basics

About

Rewriting a C codebase in Rust isn’t a big bang: it’s a marathon, where you execute a series of small, deliberate steps. This workshop teaches you how to do it incrementally, based on hard-won lessons from migrating production C codebases over to Rust.

We’ll start with FFI fundamentals (repr(C), bindgen, cbindgen), move to writing correct extern “C” interfaces, then work through a 4-step module rewrite process: encapsulate, rewrite, bridge, swap. Along the way, we’ll cover the pitfalls (mixed allocators, string encoding, performance overhead) and some of the high-level strategies you can use when planning out a large-scale migration. There will be hands-on exercises at each stage.

Description

At the end of the workshop, participants will be able to:

  • Set up bidirectional C/Rust FFI with appropriate tooling (bindgen, cbindgen)
  • Write correct and ergonomic extern “C” functions
  • Apply a systematic process to rewrite a C module in Rust
  • Avoid common interoperability pitfalls

Prerequisites

Participants are expected to bring a laptop to work on hands-on exercises. You’ll receive instructions via email, ahead of the workshop, detailing what software has to be installed beforehand.

Arrow pointing from C to Rust
Mentor

Luca Palmieri

Luca Palmieri builds technology products for a living. His current focus is on backend development, software architecture and the Rust programming language.

He currently works at Mainmatter as a Principal Engineering Consultant. He partners with teams across the industry to make sure they succeed in adopting or scaling their Rust usage, where it makes sense to do so. He was formerly at AWS and TrueLayer. He has been part of the Rust community since 2018 and is best known as the author of Zero to Production in Rust, an introduction to using Rust for backend development.