~/talk

Traits and You: A Deep Dive

Talkat Rust Belt Rust 2017 · 2017-10-26..10-27· [rust]
slides:none on file

Covers concrete, testable claims: traits separate behavior from data, trait methods can have defaults (Constitution bonus = 2 for dwarf, 1 for half‑orc, 0 default for elf/human), trait bounds make functions accept only types that implement a trait and produce a compile‑time error when trait not implemented, and trait objects let heterogeneous collections work via pointers to heap data. Demonstrates building a spellbook as a Vec<Box<dyn Cast>> with a run method that iterates and calls cast on each entry.

AI-written summary · about

  1. 0:00Intro
  2. 0:19Traits are awesome!
  3. 0:46I have learned to harness the power of traits....
  4. 2:07Traits 101: Intro to Traits
  5. 5:41The constitution bonus for a dwarf is 2
  6. 6:56The constitution bonus for a half-orc is 1
  7. 9:41Traits 201: Trait Bounds
  8. 10:46Let's make a function for speaking Elvish
  9. 12:51Trait bounds allow a function to only accept types that implement a certain trait
  10. 13:11Traits 301: Trait Objects
  11. 14:09Trait objects behave more like traditional objects
  12. 15:01You cannot add data to a trait object
  13. 20:41Trait objects are great for heterogenus collections
  14. 21:13Traits are hard... at first
~/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.