Une collection organisée de snippets de code pour accélérer votre développement. Parcourez, recherchez et copiez en un clic.
panic!("crash and burn");
use std::io::{self, Read};
fn lire_nom_utilisateur_depuis_fichier() -> Result<String, io::Error> {
let mut f = File::open("hello.txt")?;
let mut s = String::new();
f.read_to_string(&mut s)?;
Ok(s)
}
let f = File::open("hello.txt").unwrap();
let f = File::open("hello.txt").expect("Échec à l'ouverture de hello.txt");
use std::fs::File;
let f = File::open("hello.txt");
let f = match f {
Ok(file) => file,
Err(error) => panic!("Problème à l'ouverture du fichier : {:?}", error),
};