comparison examples/anmrenderer.rs @ 752:5e5e7136ac92

examples: Return a Result for load_file_into_vec()
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 29 Jan 2020 17:45:25 +0100
parents 0fed350d1778
children a662dddd4a2b
comparison
equal deleted inserted replaced
751:eab7dde1164f 752:5e5e7136ac92
105 } 105 }
106 let anm_filename = Path::new(&args[1]); 106 let anm_filename = Path::new(&args[1]);
107 let script: u8 = args[2].parse().expect("number"); 107 let script: u8 = args[2].parse().expect("number");
108 108
109 // Open the ANM file. 109 // Open the ANM file.
110 let buf = load_file_into_vec(anm_filename); 110 let buf = load_file_into_vec(anm_filename).unwrap();
111 let (_, mut anms) = Anm0::from_slice(&buf).unwrap(); 111 let (_, mut anms) = Anm0::from_slice(&buf).unwrap();
112 let anm0 = anms.pop().unwrap(); 112 let anm0 = anms.pop().unwrap();
113 113
114 if !anm0.scripts.contains_key(&script) { 114 if !anm0.scripts.contains_key(&script) {
115 eprintln!("This anm0 doesn’t contain a script named {}.", script); 115 eprintln!("This anm0 doesn’t contain a script named {}.", script);