Library authors often face a painful trade-off: support optional features via a labyrinth of compile-time #[cfg] gates, or rely on stubbed defaults and API toggles that push feature negotiation to runtime - at the expense of binary bloat and runtime assertions.
This talk explores a third option: the "Inlineable Dyn Extension Trait" (IDET) pattern. By leveraging Rust's type system and modern compiler optimizations, it is possible to write zero-cost APIs that offer the best of all worlds: a seamless DevEx without #[cfg] gates, assertion-less static/dynamic feature negotiation, and codegen that consistently strips unused features as dead code.
This session is informed by the architecture and evolution of the `gdbstub` crate - an ergonomic, feature-rich, and easy-to-integrate implementation of the GDB Remote Serial Protocol.
Attendees will learn how to design flexible, modular, ergonomic libraries that scale from no_std microcontrollers to modern hypervisors, without succumbing to "#[cfg]-hell".
Daniel is a Systems Software Engineer who has been writing Rust since 2017. He is the author of `gdbstub`, and a former core dev on the OpenVMM project.