blob: 40b1faf22cc0c5987573607887411a1cd1860807 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
mod context;
mod picture;
mod piece;
use std::error::Error;
use context::Context;
use picture::Picture;
use piece::Piece;
fn main() -> Result<(), Box<dyn Error>> {
println!("Hello, world!");
let ctx = Context::new_with_args()?;
let mut pieces = ctx.get_image_files()?.iter()
.map(|file| -> Result<Piece, Box<dyn Error>> {
let pic = Picture::new_from_file(&file)?;
Ok(Piece::new(&ctx, pic)?)
}).collect::<Result<Vec<Piece>, Box<dyn Error>>>()?;
pieces.sort();
pieces.reverse();
piece::create_index(&ctx, &pieces[..])?;
Ok(())
}
|