diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-12-18 20:49:53 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-12-18 20:49:53 +0100 |
commit | bb63c3de0c295b81ce02dc9431f346ae25eafdbc (patch) | |
tree | a14f0f334888cf6b260b15e399466ee926486ad3 | |
parent | 000b41ecfab76a1133245659e284e53dd815bf79 (diff) |
Refactor: Split app module
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | gui/src/app/message.rs | 23 | ||||
-rw-r--r-- | gui/src/app/mod.rs (renamed from gui/src/app.rs) | 22 |
2 files changed, 28 insertions, 17 deletions
diff --git a/gui/src/app/message.rs b/gui/src/app/message.rs new file mode 100644 index 0000000..a357d8e --- /dev/null +++ b/gui/src/app/message.rs @@ -0,0 +1,23 @@ +use std::sync::Arc; + +use cid::Cid; + +use distrox_lib::profile::Profile; +use distrox_lib::types::Payload; + +#[derive(Debug, Clone)] +pub enum Message { + Loaded(Arc<Profile>), + FailedToLoad, + + InputChanged(String), + CreatePost, + + PostCreated(Cid), + PostCreationFailed(String), + + PostLoaded((Payload, String)), + PostLoadingFailed, + + TimelineScrolled(f32), +} diff --git a/gui/src/app.rs b/gui/src/app/mod.rs index bc5fa17..f04713b 100644 --- a/gui/src/app.rs +++ b/gui/src/app/mod.rs @@ -9,12 +9,15 @@ use iced::Scrollable; use iced::TextInput; use iced::scrollable; use iced::text_input; - use distrox_lib::profile::Profile; + use crate::timeline::Timeline; use crate::timeline::PostLoadingRecipe; use crate::post::Post; +mod message; +pub use message::Message; + #[derive(Debug)] enum Distrox { Loading, @@ -32,22 +35,6 @@ struct State { timeline: Timeline, } -#[derive(Debug, Clone)] -pub enum Message { - Loaded(Arc<Profile>), - FailedToLoad, - - InputChanged(String), - CreatePost, - - PostCreated(cid::Cid), - PostCreationFailed(String), - - PostLoaded((distrox_lib::types::Payload, String)), - PostLoadingFailed, - - TimelineScrolled(f32), -} impl Application for Distrox { type Executor = iced::executor::Default; // tokio @@ -229,3 +216,4 @@ pub fn run(name: String) -> Result<()> { Distrox::run(settings).map_err(anyhow::Error::from) } + |