Closed Kanet1105 closed 2 hours ago
Enable ChainType deserialization from snake case String.
ChainType
String
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] #[serde(try_from = "String")] pub enum ChainType { Ethereum, } impl TryFrom<String> for ChainType { type Error = SignatureError; fn try_from(value: String) -> Result<Self, Self::Error> { match value.as_str() { "ethereum" => Ok(Self::Ethereum), _others => Err(SignatureError::UnsupportedChainType(value)), } } }
closed by: d5dea4d83feade6651feeb19e190185e281caa66
Describe the feature
Enable
ChainType
deserialization from snake caseString
.Solution