use std::fs::File;
use std::io::{self, ErrorKind};

fn main() {
    match File::open("nonexistent.txt") {
        Ok(_) => println!("File opened successfully!"),
        Err(error) => match error.kind() {
            ErrorKind::NotFound => println!("File not found."),
            ErrorKind::PermissionDenied => println!("Permission denied."),
            _ => println!("An unexpected error occurred: {:?}", error),
        },
    }
}