Mercurial > touhou
comparison examples/eclrenderer.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 |
---|---|
99 let anm_filename = Path::new(&args[2]); | 99 let anm_filename = Path::new(&args[2]); |
100 let rank: Rank = args[3].parse().expect("rank"); | 100 let rank: Rank = args[3].parse().expect("rank"); |
101 let sub: u16 = args[4].parse().expect("number"); | 101 let sub: u16 = args[4].parse().expect("number"); |
102 | 102 |
103 // Open the ECL file. | 103 // Open the ECL file. |
104 let buf = load_file_into_vec(ecl_filename); | 104 let buf = load_file_into_vec(ecl_filename).unwrap(); |
105 let (_, ecl) = Ecl::from_slice(&buf).unwrap(); | 105 let (_, ecl) = Ecl::from_slice(&buf).unwrap(); |
106 | 106 |
107 // Open the ANM file. | 107 // Open the ANM file. |
108 let buf = load_file_into_vec(anm_filename); | 108 let buf = load_file_into_vec(anm_filename).unwrap(); |
109 let (_, mut anms) = Anm0::from_slice(&buf).unwrap(); | 109 let (_, mut anms) = Anm0::from_slice(&buf).unwrap(); |
110 let anm0 = anms.pop().unwrap(); | 110 let anm0 = anms.pop().unwrap(); |
111 let anm0 = Rc::new(RefCell::new([anm0.clone(), anm0])); | 111 let anm0 = Rc::new(RefCell::new([anm0.clone(), anm0])); |
112 | 112 |
113 if ecl.subs.len() < sub as usize { | 113 if ecl.subs.len() < sub as usize { |