Skip to content

Strings practice problems in Rust

Difficulty:
Category:
Tag:

Showing 27 of 27

Status Title Difficulty
Borrow it or own it: your first lifetime decision Easy
Case-insensitive search without allocating Easy
collect and the turbofish: three targets, one source Medium
Cow: borrow until you have to own Medium
Cow in API design: impl Into<Cow<str>> Hard
flat_map: expand a range spec like "1-3,7,10-12" Medium
Giving ownership back Medium
Grouping without itertools: anagram buckets Medium
if is an expression Easy
iter, iter_mut, into_iter: all three, one Vec Easy
Joining owned strings Easy
Let elision do it Easy
Move or borrow: the two ways to pass a value Easy
Move semantics: the relay Easy
`?` on Option, and bridging to Result Medium
peekable and next_if: write a tokeniser Hard
Shadowing: rebinding is not mutation Easy
Slices are borrows Easy
String and text performance, graded Medium
String building: push_str, write!, and the 590x cliff Easy
Strings are UTF-8: bytes, chars, and the indexing panic Hard
String vs &str, part 2: functions that take and return text Medium
&str not &String, &[T] not &Vec<T> — deref coercion and ptr_arg Easy
take_while and skip_while: split a message at the blank line Easy
The three rules of ownership Easy
Two inputs, one output lifetime Medium
Zero-copy parsing: borrow, don't allocate Medium