| Commit message (Collapse) | Author | Age |
|
|
|
|
|
| |
Since static_assertions 1.0.0, we no longer have to specify a label when
calling an assert macro. Therefore we can also remove the label from
our own assert macro assert_maximum_size.
|
|
|
|
|
|
|
| |
This patch updates the static_assertions dependency to 1.1.0. This
bumps the minimum supported Rust version to 1.37.0. As the labels have
been removed in version 1.0.0, we can now call the assertion macros
without an additional label.
|
|
|
|
|
|
| |
The request and response structs for a command should not be bigger than
the buffer they are read from or written to. Therefore we add
assertions that enforce this property at compile time.
|
|
|
|
|
| |
To increase type safety, we use references to (sized) arrays instead of
slices where possible.
|
|
|
|
|
|
| |
By providing a custom Serialize implementation, we make sure that enum
variants are not mapped to their index, but to their discriminant. This
allows us to use serde when preparing the response packet.
|
|
|
|
|
|
|
| |
The execute_raw method does not have to be part of the Command trait.
In order to simplify the Command trait and to make future changes
easier, we remove the execute_raw method and replace it with the execute
function.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
We need several enums that map to a u8 value. This patch adds the
enum_u8 macro that automatically derives the From and TryFrom macros for
an enum to make these conversions easier.
As TryFrom is not stable yet, we add our own TryFrom trait.
|