1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// extern crate core;
//
// #[cfg(feature = "std")]
// use std::fmt::{self, Display};
// #[cfg(not(feature = "std"))]
// use self::core::fmt::{self, Display};
// use serde::{de};
//
// pub type Result<T> = core::result::Result<T, Error>;
// #[derive(Clone, Debug, PartialEq)]
// pub struct Error {
// pub err: ErrorImpl,
// }
//
// #[cfg(any(feature = "std"))]
// type ErrorImpl = Box<str>;
// #[cfg(not(feature = "std"))]
// type ErrorImpl = ();
//
// impl de::Error for Error {
// #[cfg(feature = "std")]
// fn custom<T>(msg: T) -> Self
// where
// T: Display,
// {
// Error {
// err: msg.to_string().into_boxed_str(),
// }
// }
//
// #[cfg(not(feature = "std"))]
// fn custom<T>(msg: T) -> Self
// where
// T: Display,
// {
// let _ = msg;
// Error { err: () }
// }
// }
//
// impl Display for Error {
// #[cfg(any(feature = "std"))]
// fn fmt(&self, formatter: &mut fmt::Formatter) -> core::Result<(), fmt::Error> {
// formatter.write_str(&self.err)
// }
//
// #[cfg(not(feature = "std"))]
// fn fmt(&self, formatter: &mut fmt::Formatter) -> core::result::Result<(), fmt::Error> {
// formatter.write_str("Serde deserialization error")
// }
// }