From 9df0f3bd565dfbf8c97d02969a17504c688bf381 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 18 Feb 2019 21:36:31 +0000 Subject: 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 from a CommandId. Instead, we directly delegate the execute method to the corresponding Command. --- src/main.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main.rs') 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; -- cgit v1.2.1