move struct definition before functions

This commit is contained in:
figsoda 2020-11-02 11:19:45 -05:00
parent 49b893db42
commit b67f8bb052

View file

@ -26,18 +26,6 @@ use std::{
use crate::config::Config;
fn cleanup() -> Result<()> {
disable_raw_mode().context("Failed to clean up terminal")?;
execute!(stdout(), LeaveAlternateScreen, DisableMouseCapture)
.context("Failed to clean up terminal")?;
Ok(())
}
fn die<T>(e: impl Into<Error>) -> T {
eprintln!("{:?}", cleanup().map_or_else(|x| x, |_| e.into()));
exit(1);
}
#[derive(Debug)]
enum Command {
Quit,
@ -62,6 +50,18 @@ enum Command {
JumpUp,
}
fn cleanup() -> Result<()> {
disable_raw_mode().context("Failed to clean up terminal")?;
execute!(stdout(), LeaveAlternateScreen, DisableMouseCapture)
.context("Failed to clean up terminal")?;
Ok(())
}
fn die<T>(e: impl Into<Error>) -> T {
eprintln!("{:?}", cleanup().map_or_else(|x| x, |_| e.into()));
exit(1);
}
#[tokio::main]
async fn main() {
let res = run().await;