~/talk

Heterogeneous Lists in Rust and Their Superpowers

TalkinRussianat RustCon 2021 · on Friday, 2021-12-03· [rust, functional-programming]
links:none on file
slides:none on file

Shows how to use heterogeneous lists (an FP-style HList) in Rust to emulate missing features like structural typing and variadic generics. Demonstrates concrete patterns for converting between structs with similar field sets without boilerplate, extracting arbitrary fields from JSON for many field combinations without writing per-combination types, and composing types with shared generic behavior so the correct variant is chosen by the desired result type — all type-safe, zero-cost at runtime, and without unsafe code.

AI-written summary · about

  1. 0:00Introduction
  2. 1:50HList basics
  3. 3:38JSON parsing problem
  4. 8:32Defining HList in Rust
  5. 10:00HList macros
  6. 12:10Extracting fields
  7. 13:16Structural typing
  8. 15:02Generic conversion
  9. 17:12Field name tracking
  10. 21:30Multiple field extraction
  11. 24:01Index extraction
  12. 27:18Usage examples
  13. 30:10Advanced extraction
  14. 33:40Transforming structures
  15. 35:46Diesel ORM use case
  16. 36:53Summary
  17. 37:39Q&A
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.