From the course: Rust for Java Developers

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Challenge: Analyze a messy CSV file

Challenge: Analyze a messy CSV file - Rust Tutorial

From the course: Rust for Java Developers

Challenge: Analyze a messy CSV file

(upbeat music) - [Instructor] Welcome to the Report Generation Challenge, where we are going to be deep diving into Result and Option. Your task is to fix several problems in a program that relates to the use or perhaps misuse of the Result and Option type. Here are two examples from the code that you'll see in the source code repository. You can see that we have TODO: fix annotated in two places. To address the first TODO, I've added the question mark operator. This propagates errors back to the caller to handle. In the second example, the compiler will raise a type error. If you look at the Return type, you'll see TypedCSV wrapped in Result. As it stands, the function doesn't do this. Instead, it attempts to return a TypedCSV by itself. To comply with the Return type, wrap the TypedCSV in Ok. Ok is the variant of Result that indicates success. Good luck with the challenge. I'm looking forward to seeing your solution. You…

Contents