from i32 is added

This commit is contained in:
병준 박 2022-08-04 09:13:23 +00:00
parent 40fe5e8e86
commit d0e1e2cf46

View File

@ -35,14 +35,33 @@ pub struct InvalidParamsDetail {
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)] #[repr(i32)]
pub enum InvalidParamsType { pub enum InvalidParamsType {
DateTime = 0, None = 0,
Decimal = 1, DateTime = 1,
EqualsTo = 2, Decimal = 2,
Float = 3, EqualsTo = 3,
Integer = 4, Float = 4,
Range = 5, Integer = 5,
RegEx = 6, Range = 6,
Required = 7, RegEx = 7,
StringLength = 8, Required = 8,
Url = 9, StringLength = 9,
Url = 10,
}
impl From<i32> for InvalidParamsType {
fn from(s: i32) -> Self {
match s {
s if s == InvalidParamsType::DateTime as i32 => InvalidParamsType::DateTime,
s if s == InvalidParamsType::Decimal as i32 => InvalidParamsType::Decimal,
s if s == InvalidParamsType::EqualsTo as i32 => InvalidParamsType::EqualsTo,
s if s == InvalidParamsType::Float as i32 => InvalidParamsType::Float,
s if s == InvalidParamsType::Integer as i32 => InvalidParamsType::Integer,
s if s == InvalidParamsType::Range as i32 => InvalidParamsType::Range,
s if s == InvalidParamsType::RegEx as i32 => InvalidParamsType::RegEx,
s if s == InvalidParamsType::Required as i32 => InvalidParamsType::Required,
s if s == InvalidParamsType::StringLength as i32 => InvalidParamsType::StringLength,
s if s == InvalidParamsType::Url as i32 => InvalidParamsType::Url,
_ => InvalidParamsType::None,
}
}
} }