app.rs (1570B)
1 use notedeck::{AppContext, AppResponse}; 2 3 use notedeck_columns::Damus; 4 use notedeck_dave::Dave; 5 6 #[cfg(feature = "clndash")] 7 use notedeck_clndash::ClnDash; 8 9 #[cfg(feature = "messages")] 10 use notedeck_messages::MessagesApp; 11 12 #[cfg(feature = "dashboard")] 13 use notedeck_dashboard::Dashboard; 14 15 #[cfg(feature = "notebook")] 16 use notedeck_notebook::Notebook; 17 18 #[allow(clippy::large_enum_variant)] 19 pub enum NotedeckApp { 20 Dave(Box<Dave>), 21 Columns(Box<Damus>), 22 23 #[cfg(feature = "notebook")] 24 Notebook(Box<Notebook>), 25 26 #[cfg(feature = "clndash")] 27 ClnDash(Box<ClnDash>), 28 29 #[cfg(feature = "messages")] 30 Messages(Box<MessagesApp>), 31 32 #[cfg(feature = "dashboard")] 33 Dashboard(Box<Dashboard>), 34 35 Other(Box<dyn notedeck::App>), 36 } 37 38 impl notedeck::App for NotedeckApp { 39 #[profiling::function] 40 fn update(&mut self, ctx: &mut AppContext, ui: &mut egui::Ui) -> AppResponse { 41 match self { 42 NotedeckApp::Dave(dave) => dave.update(ctx, ui), 43 NotedeckApp::Columns(columns) => columns.update(ctx, ui), 44 45 #[cfg(feature = "notebook")] 46 NotedeckApp::Notebook(notebook) => notebook.update(ctx, ui), 47 48 #[cfg(feature = "clndash")] 49 NotedeckApp::ClnDash(clndash) => clndash.update(ctx, ui), 50 51 #[cfg(feature = "messages")] 52 NotedeckApp::Messages(dms) => dms.update(ctx, ui), 53 54 #[cfg(feature = "dashboard")] 55 NotedeckApp::Dashboard(db) => db.update(ctx, ui), 56 57 NotedeckApp::Other(other) => other.update(ctx, ui), 58 } 59 } 60 }