~/talk

Using Generics Effectively

Talkat RustConf 2016 · 2016-09-09..09-10· [rust]
slides:none on file

The uploader shows code from Naughty, a terminal that handles Unicode, double-width characters and inline images, and reports that typical apps have about a 1:20 trait to type ratio while Naughty sits at a 1:8 ratio (90 types, 12 traits versus Cargo’s ~200 types and 10 traits). A huge enum-based write method balloons to over a hundred lines; refactoring to a writer trait makes the top-level write one line, isolates mutation, and enables lightweight mock implementations for clean unit tests.

AI-written summary · about

  1. 0:00Introduction
  2. 1:40Traits in Rust
  3. 3:22Traits in apps vs libraries
  4. 5:50Polymorphism traits vs enums
  5. 7:11Refactor enum to trait
  6. 12:25Traits with one impl
  7. 14:50Abstraction beyond reuse
  8. 16:57Decouple modules with traits
  9. 19:04Mocking with traits
  10. 20:51Traits vs enums
  11. 22:12Patterns in Rust
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.