This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::ErrorKind; | |
fn open_file(csv_path: &str) -> Result<File, Box<dyn std::error::Error>> { | |
match File::open(csv_path) { | |
Ok(file) => Ok(file), | |
Err(err) => { | |
match err.kind() { | |
ErrorKind::NotFound => { | |
println!("File doesn't exist"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
An example of implementing PartialEq for a custom type in Rust | |
*/ | |
#[derive(Debug, PartialEq)] | |
struct Price{ | |
amount: i32, | |
denomination: char | |
} |