near_openapi_types/
error.rs

1#[doc = r" Error from a `TryFrom` or `FromStr` implementation."]
2pub struct ConversionError(::std::borrow::Cow<'static, str>);
3impl ::std::error::Error for ConversionError {}
4impl ::std::fmt::Display for ConversionError {
5    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
6        ::std::fmt::Display::fmt(&self.0, f)
7    }
8}
9impl ::std::fmt::Debug for ConversionError {
10    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> Result<(), ::std::fmt::Error> {
11        ::std::fmt::Debug::fmt(&self.0, f)
12    }
13}
14impl From<&'static str> for ConversionError {
15    fn from(value: &'static str) -> Self {
16        Self(value.into())
17    }
18}
19impl From<bs58::decode::Error> for ConversionError {
20    fn from(value: bs58::decode::Error) -> Self {
21        Self(format!("Base58 decode error: {}", value).into())
22    }
23}
24impl From<String> for ConversionError {
25    fn from(value: String) -> Self {
26        Self(value.into())
27    }
28}