read data from a base64 encoded binary pdf file, format it and map it to JSON and save that as a UTF-8 text file
fn read_file(filename: &str) { let f = File::open(filename); ... let mut f = match f { Ok(file) => file, Err(e) => { println!("Error opening file: {:?}", e); return } }; let mut contents = String::new(); let result = f.read_to_string(&mut contents); match result { Ok(_) => { println!("File contents: {:?}", contents); } Err(e) => { println!("Error reading file: {:?}", e); return } } }