1use thiserror::Error;
4
5mod unsupported;
6
7pub mod args;
8pub mod value;
9
10pub use args::ArgsSerializer;
11pub use value::ValueSerializer;
12
13#[derive(Debug, Error)]
15#[non_exhaustive]
16pub enum Error {
17 #[error("this type is unsupported")]
18 UnsupportedType,
19 #[error("this serializer is already used")]
20 AlreadyUsed,
21 #[error("input bytes do not form a valid UTF-8 encoded string")]
22 NonUtf8Bytes,
23 #[error("invalid call sequence of map serialization methods")]
24 InvalidSerMap,
25 #[error("{0}")]
26 Custom(String),
27}
28
29impl serde::ser::Error for Error {
30 fn custom<T>(msg: T) -> Self
31 where
32 T: std::fmt::Display,
33 {
34 Error::Custom(msg.to_string())
35 }
36}