From 2bbee1633fc692b717f259521132fc124a33a312 Mon Sep 17 00:00:00 2001 From: Adrien Date: Wed, 9 Aug 2023 22:40:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Merge=20app=5Fsettings.rs=20and?= =?UTF-8?q?=20base.rs=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app_settings.rs | 31 ------------------------------- src/base.rs | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 34 deletions(-) delete mode 100644 src/app_settings.rs diff --git a/src/app_settings.rs b/src/app_settings.rs deleted file mode 100644 index 255bf7e..0000000 --- a/src/app_settings.rs +++ /dev/null @@ -1,31 +0,0 @@ -use std::cell::RefCell; -use std::rc::Rc; -use std::sync::{Arc, Mutex}; - -use crate::base::Store; -use crate::matrix_client::Requester; - -#[derive(Debug, Clone)] -pub struct AppSettings { - // pub matrix_client: Option>>, - // pub matrix_client: Arc, - // pub matrix_client: Rc>, - // pub matrix_client: Arc, - //pub matrix_client: Arc>, - pub requester: Option>, - pub store: Store, -} - -impl AppSettings { - pub fn new() -> Self { - Self { - // matrix_client: Arc::new(MatrixClient::new()), - //matrix_client: Arc::new(Mutex::new(MatrixClient::new())), - requester: None, - store: Store::new(), - // matrix_client: Arc::new(Mutex::new(MatrixClient::new())), - // matrix_client: Arc::new(MatrixClient::new()), - // matrix_client: Rc::new(RefCell::new(MatrixClient::new())), - } - } -} diff --git a/src/base.rs b/src/base.rs index 125e2c8..b3dc3ac 100644 --- a/src/base.rs +++ b/src/base.rs @@ -1,13 +1,25 @@ +use std::sync::Arc; + +use crate::matrix_client::Requester; + #[derive(Clone, Debug, Eq, PartialEq)] pub struct Store { pub is_logged: bool, } -// pub type ProgramStore = Store; -// pub type AsyncProgramStore = Arc>; - impl Store { pub fn new() -> Self { Self { is_logged: false } } } + +#[derive(Clone)] +pub struct AppSettings { + pub requester: Option>, +} + +impl AppSettings { + pub fn new() -> Self { + Self { requester: None } + } +}