aboutsummaryrefslogtreecommitdiff
path: root/src/server/cmd/commands/room_id_request.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-01 23:34:55 +0000
committerFuwn <[email protected]>2021-05-01 23:34:55 +0000
commitcb58dab1828f847ffdf51e336c34bc71d973706d (patch)
tree7f8bf76c58befda2b901d26ad4bc1980fa9e399f /src/server/cmd/commands/room_id_request.rs
parentci(actions): fix rust action not running on changes performed on the src dire... (diff)
downloadwhirl-cb58dab1828f847ffdf51e336c34bc71d973706d.tar.xz
whirl-cb58dab1828f847ffdf51e336c34bc71d973706d.zip
feat(cmds): trait based commands
This commit adds the abiltity to implement a series of given traits for a command, where each command should implement **at least** one of these traits; Parsable, ParsableWithArguments, Creatable. These changed are put in place to ensure that when implementing a command, the proper methods are implemented in the proper format.
Diffstat (limited to 'src/server/cmd/commands/room_id_request.rs')
-rw-r--r--src/server/cmd/commands/room_id_request.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/server/cmd/commands/room_id_request.rs b/src/server/cmd/commands/room_id_request.rs
index 812374c..cc8dbeb 100644
--- a/src/server/cmd/commands/room_id_request.rs
+++ b/src/server/cmd/commands/room_id_request.rs
@@ -3,12 +3,14 @@
use std::str::from_utf8;
+use crate::server::cmd::extendable::Parsable;
+
#[derive(Debug)]
pub struct RoomIdRequest {
pub room_name: String,
}
-impl RoomIdRequest {
- pub fn parse(data: Vec<u8>) -> Self {
+impl Parsable for RoomIdRequest {
+ fn parse(data: Vec<u8>) -> Self {
Self {
room_name: from_utf8(&data[4..data[0] as usize]).unwrap().to_string(),
}