Rust's trait system is a proof engine, let's make it prove us an ABI!

In this talk, I'll show you how Rust's type system can be abused to build your own ABI in stable Rust: we'll start by making it do algebra, then compute type layouts, and end up with compact sum types. Don't worry, I'll also teach you what an ABI is, and why it matters.

Abstract

Frustrated that `const generics` can't do math yet? Want to make some structure change layout based on the size of its generic parameters? Curious about how you can make lists, loops, ternaries and branches without declaring a single function? Tried to understand how `stabby` builds a stable representation for your enums and came home with a headache?

In this talk, you will learn how to make the type system do math, how to use Generic Associated Types (GATs) to do so without reaching where-clause hell, and how to have that math influence your types’ layouts.

I'll take you through stabby's secret sauce that made it the first stable ABI available in Rust to provide niche optimizations: abusing the trait system for fun and profit.

I'll teach you the ways of computation by GATs, its limits and how to play around them, and just how cursed things can get when you give a Turing complete type system to someone who listens to talks about category theory for fun. This talk will start with some context and background concepts, and continue with a more concrete code-oriented session.

Video

RustLab is a conference made by Develer.
Develer is a company based in Campi Bisenzio, near Florence. Our motto is : "Technology to give life to your products". We produce hardware and software to create exceptional products and to improve industrial processes and people's well being.
In Develer we have passion for the new technologies and we offer our clients effective solutions that are also efficient, simple and safe for the end users. We also believe in a friendly and welcoming environment where anybody can give their contribution. This passion and this vision are what we've been driven to organize our conference "made by developers for developers".

Subscribe to our newsletter

We hate spam just as much as you do, which is why we promise to only send you relevant communications. We respect your privacy and will never share your information with third parties.
©2024 RustLab | The international conference on Rust in Florence-Design & devCantiere Creativo-Made withDatoCMS