simple/simple.rs
1use {
2 cursive::{views::*, *},
3 cursive_image::*,
4};
5
6// PNG is natively supported by the terminal and is thus the most efficient format
7const FILE: &str = "assets/media/linux.png";
8
9fn main() {
10 let mut cursive = default();
11
12 // By default the image view uses "shrink" sizing
13
14 cursive.add_layer(Panel::new(ImageView::default().with_image(Image::new_file(
15 FILE,
16 false,
17 ImageFormat::PNG,
18 (96, 96),
19 ))));
20
21 cursive.add_global_callback('q', |cursive| cursive.quit());
22
23 cursive.run();
24}