Understanding #[derive(Clone)] in Rust
This post assumes that you have an entry-level familiarity with Rust: you’ve fought with the borrow checker enough to start to internalize some of its model; you’ve defined structs, implemented traits on those structs, and derived implementations of common traits using macros; you’ve seen trait bounds and maybe used one or two. Most importantly, you know what the Clone trait is and why you would want to use it1. I’m using Clone as my example in this blog post, but this discussion applies to any derivable trait. If you’re not familiar with Clone, here’s a good explainer. ↩
Stegosaurus Dormant