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
use std::fmt;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("{0}")]
Message(String),
#[error("sequence has too many items, limit is 2^32")]
TooManyItems,
#[error(transparent)]
Binary(#[from] binary_rw::BinaryError),
}
impl serde::ser::Error for Error {
#[cold]
fn custom<T: fmt::Display>(msg: T) -> Self {
Self::Message(msg.to_string())
}
}
impl serde::de::Error for Error {
#[cold]
fn custom<T: fmt::Display>(msg: T) -> Self {
Self::Message(msg.to_string())
}
}