From e19cbb8be108c85629997791a5a6a117c51dcc37 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Mon, 10 May 2021 21:06:43 +0300 Subject: Remove unused code --- src/validators.rs | 44 -------------------------------------------- 1 file changed, 44 deletions(-) delete mode 100644 src/validators.rs (limited to 'src') diff --git a/src/validators.rs b/src/validators.rs deleted file mode 100644 index 31344d8..0000000 --- a/src/validators.rs +++ /dev/null @@ -1,44 +0,0 @@ -/// Custom validators incoming data - -use log::error; -use serde::de::{Deserializer, Error as DeserializerError, Unexpected}; -use serde::ser::{Error as SerializerError, Serializer}; -use serde::Deserialize; - -pub mod validate_block { - use super::*; - - const ERROR_MESSAGE: &str = "block cannot have an empty transaction list"; - - pub fn deserialize<'de, D>(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let value = u8::deserialize(deserializer)?; - - if value > 100 { - error!("{}", ERROR_MESSAGE); - - return Err(DeserializerError::invalid_value( - Unexpected::Unsigned(u64::from(value)), - &ERROR_MESSAGE, - )); - } - - Ok(value) - } - - #[allow(clippy::trivially_copy_pass_by_ref)] - pub fn serialize(value: &u8, serializer: S) -> Result - where - S: Serializer, - { - if *value > 100 { - error!("{}", ERROR_MESSAGE); - - return Err(SerializerError::custom(ERROR_MESSAGE)); - } - - serializer.serialize_u8(*value) - } -} -- cgit v1.2.3-70-g09d2