Error and basic protocol handling

This commit is contained in:
Greg Heartsfield 2021-11-23 10:29:53 -06:00
parent 5e75370a67
commit ae68fdd896
3 changed files with 8 additions and 4 deletions

View File

@ -6,4 +6,7 @@ use thiserror::Error;
pub type Result<T, E = Error> = result::Result<T, E>; pub type Result<T, E = Error> = result::Result<T, E>;
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum Error {} pub enum Error {
#[error("command from client not recognized")]
CommandNotFound,
}

View File

@ -1,5 +1,5 @@
use serde::{Deserialize, Deserializer, Serialize}; use serde::{Deserialize, Deserializer, Serialize};
use serde_json::json; //use serde_json::json;
//use serde_json::Result; //use serde_json::Result;
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
@ -32,7 +32,7 @@ fn u32_from_string<'de, D>(deserializer: D) -> Result<u32, D::Error>
where where
D: Deserializer<'de>, D: Deserializer<'de>,
{ {
let s: String = Deserialize::deserialize(deserializer)?; let _s: String = Deserialize::deserialize(deserializer)?;
Ok(0) Ok(0)
} }
@ -40,7 +40,7 @@ fn u64_from_string<'de, D>(deserializer: D) -> Result<u64, D::Error>
where where
D: Deserializer<'de>, D: Deserializer<'de>,
{ {
let s: String = Deserialize::deserialize(deserializer)?; let _s: String = Deserialize::deserialize(deserializer)?;
Ok(0) Ok(0)
} }

View File

@ -1,2 +1,3 @@
pub mod error; pub mod error;
pub mod event; pub mod event;
pub mod proto;