make primitive error handling
This commit is contained in:
parent
6557a3496c
commit
fdb19cd740
1 changed files with 6 additions and 4 deletions
10
src/main.rs
10
src/main.rs
|
@ -8,12 +8,14 @@ use std::time::Duration;
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
let sdl_context = sdl2::init().unwrap();
|
let sdl_context = sdl2::init().unwrap();
|
||||||
let vide_subsystem = sdl_context.video().unwrap();
|
let video_subsystem = sdl_context.video().unwrap();
|
||||||
|
|
||||||
let window = vide_subsystem.window("fractals", 800, 600)
|
let window = match (video_subsystem.window("fractals", 800, 600)
|
||||||
.position_centered()
|
.position_centered()
|
||||||
.build()
|
.build()) {
|
||||||
.unwrap();
|
Ok(w) => { w },
|
||||||
|
Err(_) => { panic!("Can not build window!") }
|
||||||
|
};
|
||||||
|
|
||||||
let mut canvas = window.into_canvas().build().unwrap();
|
let mut canvas = window.into_canvas().build().unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue