diff --git a/src/bill/mod.rs b/src/bill/mod.rs index a441ccf..bc02aad 100644 --- a/src/bill/mod.rs +++ b/src/bill/mod.rs @@ -64,7 +64,7 @@ use std::convert::From; use std::str::FromStr; use std::string::ToString; -#[derive(Debug, Clone, PartialEq, thiserror::Error)] +#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, thiserror::Error)] pub enum BillError { #[error("Barcode length must be 26 chars")] InvalidBarcodeLength, @@ -95,7 +95,7 @@ pub enum BillError { /// use rust_persian_tools::bill::BillType; /// assert_eq!(FromPrimitive::from_u8(2), Some(BillType::Electricity)); /// ``` -#[derive(FromPrimitive, Clone, Copy, PartialEq, Debug)] +#[derive(FromPrimitive, Clone, Copy, PartialEq, Eq, Debug, Hash)] pub enum BillType { /// آب /// Service Type Code: 1 @@ -123,7 +123,7 @@ pub enum BillType { DrivingOffence = 8, } -#[derive(Debug, PartialEq)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] pub enum CurrencyType { Rials, Tomans, @@ -136,7 +136,7 @@ pub enum CurrencyType { /// /// Checksum is calculated via [ISSN Modulo 11 check digit](https://www.activebarcode.com/codes/checkdigit/modulo11) /// -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq, Clone, Hash)] pub struct BillID { /// Maximum 8-digit Company Internal File ID pub file_id: String, @@ -216,7 +216,7 @@ impl ToString for BillID { /// Checksums are calculated via [ISSN Modulo 11 check digit](https://www.activebarcode.com/codes/checkdigit/modulo11) \ /// Checksum1 is the checksum for Payment ID itself and only checks digits in Payment ID \ /// Checksum2 is the checksum for Bill ID and Payment ID concatenated together and checks validity of relation between two IDs -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] pub struct PaymentID { /// Amount in scale 1000:1 (1000 will be 1) amount: u64, @@ -324,7 +324,7 @@ impl PaymentID { /// Container for Both Bill and Payment IDs \ /// You must use this type to extract all informations about the bill -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq, Clone, Hash)] pub struct Bill { pub bill_id: BillID, pub payment_id: PaymentID, diff --git a/src/extract_card_number/extracted_card_number.rs b/src/extract_card_number/extracted_card_number.rs index 025c280..5b4f916 100644 --- a/src/extract_card_number/extracted_card_number.rs +++ b/src/extract_card_number/extracted_card_number.rs @@ -1,4 +1,4 @@ -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone, Hash)] pub struct ExtractedCardNumber { base: String, pure: String, diff --git a/src/get_bank_name_by_card_number/errors.rs b/src/get_bank_name_by_card_number/errors.rs index 9d91716..58786a4 100644 --- a/src/get_bank_name_by_card_number/errors.rs +++ b/src/get_bank_name_by_card_number/errors.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Clone, PartialEq, Eq, Debug, Hash)] pub enum BankNameByCardNumberError { #[error("card number: {0:?} with length of {1:?} is too short minimum is 6")] TooShort(String, usize), diff --git a/src/get_place_by_iran_national_id/errors.rs b/src/get_place_by_iran_national_id/errors.rs index 435c91d..4966f78 100644 --- a/src/get_place_by_iran_national_id/errors.rs +++ b/src/get_place_by_iran_national_id/errors.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Debug, PartialEq, Eq, Clone, Copy, Hash)] pub enum PlaceByNationalIdError { #[error("national id is too short len:{0}")] TooShortNationalId(usize), diff --git a/src/get_place_by_iran_national_id/place_by_iran_national_id.rs b/src/get_place_by_iran_national_id/place_by_iran_national_id.rs index 8352de5..05635b4 100644 --- a/src/get_place_by_iran_national_id/place_by_iran_national_id.rs +++ b/src/get_place_by_iran_national_id/place_by_iran_national_id.rs @@ -1,4 +1,4 @@ -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash)] pub struct PlaceByNationalId { city: &'static str, province: &'static str, diff --git a/src/legal_id/errors.rs b/src/legal_id/errors.rs index 0b89e1b..3402f1b 100644 --- a/src/legal_id/errors.rs +++ b/src/legal_id/errors.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Debug, PartialEq, Eq, Clone, Copy, Hash)] pub enum VerifyLegalIdError { #[error("invalid len legal id should be 11 chars")] InvalidLength, diff --git a/src/national_id/mod.rs b/src/national_id/mod.rs index ff90fac..a2f8561 100644 --- a/src/national_id/mod.rs +++ b/src/national_id/mod.rs @@ -64,7 +64,7 @@ use std::num::ParseIntError; pub mod serde; /// Possible errors during validation of Iranian National Number. -#[derive(Debug, PartialEq, thiserror::Error)] +#[derive(Debug, PartialEq, Eq, thiserror::Error)] pub enum NationalIdError { /// If input length is invalid. #[error("Invalid length {0} for National Number")] diff --git a/src/number_plate/errors.rs b/src/number_plate/errors.rs index 54590d4..023ed6d 100644 --- a/src/number_plate/errors.rs +++ b/src/number_plate/errors.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Debug, PartialEq, Eq, Clone, Hash)] pub enum PlateNumberError { #[error("plate numbers must be 7 or 8 digits long")] InvalidPlateDigitLength, diff --git a/src/number_plate/types.rs b/src/number_plate/types.rs index 78fe9e4..03113e0 100644 --- a/src/number_plate/types.rs +++ b/src/number_plate/types.rs @@ -1,10 +1,10 @@ -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone, Copy, Hash, Eq)] pub enum PlateTypes { Car = 1, Motorcycle = 2, } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone, Hash, Eq)] pub struct CarPlateDetail { pub first_two_digits: String, pub plate_character: String, @@ -12,19 +12,19 @@ pub struct CarPlateDetail { pub province_code: String, } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone, Hash, Eq)] pub struct MotorcyclePlateDetail { pub digits: String, pub province_code: String, } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone, Hash, Eq)] pub enum PlateResultDetails { CarDetail(CarPlateDetail), MotorcycleDetail(MotorcyclePlateDetail), } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone, Hash, Eq)] pub struct Plate { pub template: String, pub province: String, @@ -33,7 +33,7 @@ pub struct Plate { pub category: Option, } -#[derive(PartialEq, Debug)] +#[derive(PartialEq, Debug, Clone, Hash, Eq)] pub struct NormalizedPlate { pub numbers: String, pub char: Option, diff --git a/src/number_to_words/error.rs b/src/number_to_words/error.rs index 5c4cc4c..d0b6c53 100644 --- a/src/number_to_words/error.rs +++ b/src/number_to_words/error.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Clone, Debug, Hash, PartialEq, Eq)] pub enum NumberToWordsError { #[error("number_to_words_str input is empty")] EmptyString, diff --git a/src/phone_number/mod.rs b/src/phone_number/mod.rs index b52ff2e..a2bdbaa 100644 --- a/src/phone_number/mod.rs +++ b/src/phone_number/mod.rs @@ -4,7 +4,7 @@ use thiserror::Error; pub static PREFIXES: [&str; 4] = ["+98", "98", "0098", "0"]; -#[derive(Error, Debug)] +#[derive(Error, Clone, Debug, Hash, PartialEq, Eq)] pub enum PhoneNumberError { #[error("This prefix is not a valid phone number (prefix : `{0}`)")] InvalidPrefix(String), diff --git a/src/phone_number/operators.rs b/src/phone_number/operators.rs index 64516e4..8e125c4 100644 --- a/src/phone_number/operators.rs +++ b/src/phone_number/operators.rs @@ -393,7 +393,7 @@ pub mod constants { )]; } -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Hash, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum Operator { ShatelMobile, @@ -403,14 +403,14 @@ pub enum Operator { RightTel, } -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Hash, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub enum SimType { Permanent, Credit, } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Hash, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(bound(deserialize = "'de: 'a")))] pub struct OperatorDetails<'a> { diff --git a/src/sheba/bank_info.rs b/src/sheba/bank_info.rs index 002b3e3..8a6a767 100644 --- a/src/sheba/bank_info.rs +++ b/src/sheba/bank_info.rs @@ -105,7 +105,7 @@ pub(super) fn get_bank_info(s: u32) -> Option { }) } -#[derive(PartialEq, Eq, Debug)] +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash)] pub struct ShebaResult { pub(super) name: &'static str, pub(super) code: &'static str, diff --git a/src/sheba/errors.rs b/src/sheba/errors.rs index 643529a..dded5f7 100644 --- a/src/sheba/errors.rs +++ b/src/sheba/errors.rs @@ -2,7 +2,7 @@ use std::num::ParseIntError; use thiserror::Error; -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Clone, Copy, Debug, Hash, PartialEq, Eq)] pub enum ShebaValidationError { #[error("empty")] Empty, diff --git a/src/time_diff/mod.rs b/src/time_diff/mod.rs index cfefa12..9ce6d63 100644 --- a/src/time_diff/mod.rs +++ b/src/time_diff/mod.rs @@ -7,7 +7,7 @@ pub(crate) const DAY: i64 = HOUR * 24; pub(crate) const MONTH: i64 = DAY * 30; pub(crate) const YEAR: i64 = DAY * 365; -#[derive(Error, Debug)] +#[derive(Error, Clone, Copy, Debug, Hash, PartialEq, Eq)] pub enum TimeAgoError { #[error("Wrong datetime format !")] InvalidDateTimeFormat, @@ -23,7 +23,7 @@ pub enum TimeAgoError { /// the `long_form()` returns a long and exact desciption about time diffrence\ /// - 6 سال و 6 ماه و 10 روز و 12 دقیقه و 37 ثانیه بعد /// -#[derive(Debug, PartialEq)] +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash)] pub struct TimeDiff { pub years: u32, pub months: u8, diff --git a/src/url_fix/mod.rs b/src/url_fix/mod.rs index e93e9ed..7696d8a 100644 --- a/src/url_fix/mod.rs +++ b/src/url_fix/mod.rs @@ -1,7 +1,6 @@ use std::string::FromUtf8Error; use urlencoding::decode; -pub enum UrlFixError {} /// description Used for fix Persian characters in URL
/// separator: space by default diff --git a/src/words_to_number/errors.rs b/src/words_to_number/errors.rs index d23483e..c4499cc 100644 --- a/src/words_to_number/errors.rs +++ b/src/words_to_number/errors.rs @@ -1,6 +1,6 @@ use thiserror::Error; -#[derive(Error, Debug, PartialEq, Eq)] +#[derive(Error, Clone, Copy, Debug, Hash, PartialEq, Eq)] pub enum WordsToNumberError { #[error("There is a invalid unit in the input")] InvalidUnit, diff --git a/src/words_to_number/mod.rs b/src/words_to_number/mod.rs index ac8ff5b..20967e8 100644 --- a/src/words_to_number/mod.rs +++ b/src/words_to_number/mod.rs @@ -12,13 +12,14 @@ use self::{ errors::WordsToNumberError, }; -#[derive(Debug, PartialEq)] +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash)] pub enum Language { Arabic, Persian, English, } +#[derive(PartialEq, Eq, Debug, Clone, Copy, Hash)] pub struct Options { pub digits: Language, pub add_commas: bool,