File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ pub enum Page {
2929
3030/// The types of arrow keys
3131#[ allow( dead_code) ]
32- #[ derive( Debug , Clone ) ]
32+ #[ derive( Debug , Clone , PartialEq ) ]
3333pub enum ArrowKey {
3434 Up ,
3535 Down ,
@@ -38,7 +38,7 @@ pub enum ArrowKey {
3838}
3939
4040/// The ways the cursor can move when a key is pressed
41- #[ derive( Debug , Clone ) ]
41+ #[ derive( Debug , Clone , PartialEq ) ]
4242pub enum Move {
4343 Back ,
4444 Forwards ( String ) ,
Original file line number Diff line number Diff line change @@ -30,8 +30,19 @@ pub enum AppCommand {
3030 Display ,
3131}
3232
33+ impl PartialEq for AppCommand {
34+ fn eq ( & self , other : & Self ) -> bool {
35+ // TODO: make an *actual* impl of PartialEq for Message
36+ match ( & self , & other) {
37+ ( Self :: Function ( a) , Self :: Function ( b) ) => a == b,
38+ ( Self :: Display , Self :: Display ) => true ,
39+ _ => false
40+ }
41+ }
42+ }
43+
3344/// A container for [`App`] data specific to a certain type of app.
34- #[ derive( Debug , Clone ) ]
45+ #[ derive( Debug , Clone , PartialEq ) ]
3546pub enum AppData {
3647 /// A platform specific executable
3748 Executable {
@@ -83,11 +94,15 @@ pub struct App {
8394
8495impl PartialEq for App {
8596 fn eq ( & self , other : & Self ) -> bool {
86- self . id == other. id
97+ self . app_data == other. app_data &&
98+ self . name == other. name
8799 }
88100}
89101
90102impl App {
103+ /// Get the internal id
104+ pub fn id ( & self ) -> usize { self . id }
105+
91106 /// Creates a new instance
92107 pub fn new ( name : & str , name_lc : & str , desc : & str , data : AppData ) -> Self {
93108 static ID : AtomicUsize = AtomicUsize :: new ( 0 ) ;
You can’t perform that action at this time.
0 commit comments