diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 90b68de..c288e9e 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -7,8 +7,27 @@ use std::ops::Index; use zeroize::Zeroize; #[derive(Clone, Debug)] -pub enum Commands { - Request(Option>), +pub enum Commands { + // Common fields: + executable: T, + params: Option>, + + // Variants: + Request {}, + Info {}, + + Connect {}, + Disconnect {}, + + ClientUpdate {}, + ClientInfo {}, + ClientRemove {}, + Client {}, + + Success {}, + Error {}, + + /*Request(Option>), Info(Option>), Connect(Option>), @@ -20,7 +39,11 @@ pub enum Commands { Client(Option>), Success(Option>), - Error(Option>), + Error(Option>),*/ +} + +trait Operations { + fn execute(&self); } impl Commands { @@ -51,6 +74,12 @@ impl Commands { } } +impl Operations for Commands { + fn execute(&self) { + self.executable.run(); + } +} + impl PartialEq for Commands { fn eq(&self, other: &Self) -> bool { match (self, other) {