mirror of
https://github.com/figsoda/mmtc
synced 2024-11-26 00:40:18 +00:00
move struct definition before functions
This commit is contained in:
parent
49b893db42
commit
b67f8bb052
1 changed files with 12 additions and 12 deletions
24
src/main.rs
24
src/main.rs
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue