diff_tool/update/
message.rs1use std::fmt::{self, Display};
2
3use serde::Deserialize;
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Deserialize, Ord, PartialOrd)]
6pub enum Message {
7 Quit,
8 PrevRow,
9 NextRow,
10 FirstRow,
11 LastRow,
12}
13
14impl Display for Message {
16 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
17 let str = match self {
18 Message::PrevRow => "Scroll up one row",
19 Message::NextRow => "Scroll down one row",
20 Message::LastRow => "Jump to bottom row",
21 Message::FirstRow => "Jump to top row",
22 Message::Quit => "Quit application",
23 };
24 write!(f, "{}", str)
25 }
26}