Design correct, minimal lifetime annotations for structs, functions, and trait bounds that hold references without overconstraining callers.
## CONTEXT Lifetimes are Rust's mechanism for guaranteeing that references never outlive the data they point to, enforced entirely at compile time with zero runtime cost. Most code relies on lifetime elision and needs no annotations, but the moment a function returns a reference tied to its inputs, or a struct stores…
Premium Prompt
Unlock this prompt — and all 25,000+ expert-crafted prompts — with Pro.
Unlock with Pro