map_err — transform error. and_then — chain operations.
map_err:
and_then:
1fn parse_and_double(s: &str) -> Result<i32, String> {2 s.parse::<i32>()3 .map_err(|e| e.to_string())4 .and_then(|n| Ok(n * 2))5}
Key: map_err for error conversion, and_then for chaining.