From b353589576e2bb224555ab4e626321fa675e5617 Mon Sep 17 00:00:00 2001 From: ModulatingForce <116608425+modulatingforce@users.noreply.github.com> Date: Wed, 20 Mar 2024 23:35:56 -0400 Subject: [PATCH] refactor statustype --- src/core/botmodules.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/botmodules.rs b/src/core/botmodules.rs index 870fc98..fdbddcf 100644 --- a/src/core/botmodules.rs +++ b/src/core/botmodules.rs @@ -58,7 +58,7 @@ pub enum StatusLvl { } #[derive(Debug)] -pub enum ModStatusType { +pub enum StatusType { Enabled(StatusLvl), Disabled(StatusLvl), } @@ -177,7 +177,7 @@ pub struct Routine {} pub struct ModulesManager { // statusdb: Arc>>>, - statusdb: Arc>>>, + statusdb: Arc>>>, pub botactions: Arc>>>, } @@ -226,7 +226,7 @@ impl ModulesManager { mgrarc } - pub fn modstatus(&self, _: ModType, _: ChType) -> ModStatusType { + pub fn modstatus(&self, _: ModType, _: ChType) -> StatusType { // Example usage : botmanager.modstatus( // BotModule("GambaCore"), // Channel("modulatingforce") @@ -234,15 +234,15 @@ impl ModulesManager { // - The ModStatusType checks in the context of the given channel , // but also validates based on wheher the module is disabled at a bot instance // level as well - ModStatusType::Enabled(StatusLvl::Instance) + StatusType::Enabled(StatusLvl::Instance) } - pub fn togglestatus(&self, _: ModType, _: ChType) -> ModStatusType { + pub fn togglestatus(&self, _: ModType, _: ChType) -> StatusType { // enables or disables based on current status - ModStatusType::Enabled(StatusLvl::Instance) + StatusType::Enabled(StatusLvl::Instance) } - pub fn setstatus(&self, _: ModType, _: ModStatusType) -> Result<&str, Box> { + pub fn setstatus(&self, _: ModType, _: StatusType) -> Result<&str, Box> { // sets the status based given ModSatusType // e.g., b.setstatus(BodModule("GambaCore"), Enabled(Channel("modulatingforce"))).expect("ERROR") Ok("") @@ -341,8 +341,8 @@ impl ModulesManager { let statusvector = dbt.entry((in_module.clone(),in_modgroup.clone())).or_insert(Vec::new()); match in_modgroup { - ModGroup::Core => statusvector.push(ModStatusType::Enabled(StatusLvl::Instance)) , // Pushes the Module as Enabled at Instance Level - ModGroup::Custom => statusvector.push(ModStatusType::Disabled(StatusLvl::Instance)), + ModGroup::Core => statusvector.push(StatusType::Enabled(StatusLvl::Instance)) , // Pushes the Module as Enabled at Instance Level + ModGroup::Custom => statusvector.push(StatusType::Disabled(StatusLvl::Instance)), } // statusvector.push(ModStatusType::Enabled(StatusLvl::Instance)); // Pushes the Module as Enabled at Instance Level