From C to a Rust interface, brick by brick
QEMU's Rust adventure began with direct use of the C-style interfaces generated by bindgen: this first prototype, merged not long after last year's KVM Forum, focused on build system integration and set the stage for a long journey creating safe Rust interfaces for QEMU. In this talk we will explain the process of distilling the invariants that were required and promised by QEMU's C code, and how we mapped them to concepts such as interior mutability and smart pointers. We will present the path that was followed over the past year, how we converted QEMU's HPET device model to readable Rust code, and how various ideas and components from the Rust ecosystem help bridging the Rust and C codebases.