aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-02-18 21:36:31 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-02-18 23:27:48 +0100
commit9df0f3bd565dfbf8c97d02969a17504c688bf381 (patch)
treeda3a25d4900fc82a407ac729f5642f1e65cd0fbc /src/main.rs
parent49703cd770fd0522beae2dc53d1f882c9143c64e (diff)
downloadntw-9df0f3bd565dfbf8c97d02969a17504c688bf381.tar.gz
ntw-9df0f3bd565dfbf8c97d02969a17504c688bf381.tar.bz2
Refactor command execution into commands module
This patch refactors the command execution. A command is represented by a struct implementing the Command trait. The enum_cmd macro is used to generate a mapping from the CommandId enum to a Command instance and to execute the command. The request and response data is manually converted from and to raw byte slices. As we do not have a standard library, we cannot create a Box<Command> from a CommandId. Instead, we directly delegate the execute method to the corresponding Command.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index e10f4d2..caf7fdf 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,6 +9,7 @@ extern crate panic_halt;
#[macro_use]
mod util;
+mod commands;
mod device;
mod hid;