Trials, traits, and tribulations
summary
Refactors a sprawling handler of roughly hundreds of lines into composable pieces and shows concrete wins: replaces repeated unwraps with the ? operator, wraps primitives as small domain types, implements Default/From/Into and traits, and models execution with a strategy pattern. Uses Rust plus V8 bindings (Google crate) inside Dynatrace’s JS runtime. Result is fewer panics, clearer intent, easier unit testing and contributor onboarding — a working refactor that reduces repetition and surfaces real error boundaries.
AI-written summary · about
chapters (13)
- 0:00Rust Linz meetup intro
- 1:43JavaScript runtime in Rust
- 3:49Code evolution in Rust
- 5:55Refactoring event handler
- 8:21Error handling with question marks
- 11:53Default traits for cleaner code
- 14:18Custom types for domain
- 17:05Abstracting headers with errors
- 19:36Reducing nested options
- 22:49Strategy pattern in Rust
- 26:03Refactored event handler explained
- 27:27Refactoring benefits
- 29:11Key takeaways
related talks
49mThe Eternal Sunshine of the Spotless Programming Language
23mRebuilding in Rust for Good Reason
32mTesting strategies and pattern for efficient TDD in Rust
20mBetter Together: Rust & TypeScript
21m“Fearless Refactoring & the Art of Argument-Free Rust”
40mRust’s approach of getting things right
19mRust Without Tears: A Guide to Avoiding Common Traps
25mType System Tips for the Real World
