Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Rust
/
Iterators
Which expression returns the first integer parse error instead of silently dropping inval…
from Iterators
Rust 1.98
intermediate
1 min
Which expression returns the first integer parse error instead of silently dropping invalid fields?
fields.iter().map(|s| s.parse::<i32>()).collect::<Result<Vec<_>, _>>()
fields.iter().filter_map(|s| s.parse::<i32>().ok()).collect::<Vec<_>>()
fields.iter().map_while(|s| s.parse::<i32>().ok()).collect::<Vec<_>>()
fields.iter().flat_map(|s| s.parse::<i32>()).collect::<Vec<_>>()
Check
Ask AI about this kata
Report an error
previous kata
What does this program print?
Predict the output
next kata
Review generated weight conversion
Review AI code
A new version is available
Reload