Skip to content

Lifetimes practice problems in Rust

Difficulty:
Category & tags Filters active
Category:
Tag:

Showing 19 of 19

Title Difficulty
Borrow it or own it: your first lifetime decision Easy
Cow: borrow until you have to own Medium
Cow in API design: impl Into<Cow<str>> Hard
Filter records without cloning their tags Medium
flat_map: expand a range spec like "1-3,7,10-12" Medium
Generics, traits and lifetimes in one signature Medium
longest: writing your first 'a Medium
Make the lint happy: '_ in return paths Easy
Make your own collection iterable, all three ways Hard
move: when the closure must own its captures Medium
Non-lexical lifetimes: a borrow ends at its last use Easy
Returning impl Trait, and what edition 2024 changed Hard
Slices are borrows Easy
Store owned and borrowed closures in registries Hard
Trait objects and lifetimes: Box<dyn Trait + 'a> Hard
Two inputs, one output lifetime Medium
Use lifetime elision for borrowed string results Easy
Zero-copy parsing: borrow, don't allocate Medium
Zero-copy tokenizer: Parser<'a> Hard