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
use std::{error, fmt};
#[derive(Debug, Clone, Copy)]
#[non_exhaustive]
pub enum Error {
EmptyChoose,
NotEnoughData,
IncorrectFormat,
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::EmptyChoose => write!(
f,
"`arbitrary::Unstructured::choose` must be given a non-empty set of choices"
),
Error::NotEnoughData => write!(
f,
"There is not enough underlying raw data to construct an `Arbitrary` instance"
),
Error::IncorrectFormat => write!(
f,
"The raw data is not of the correct format to construct this type"
),
}
}
}
impl error::Error for Error {}
pub type Result<T> = std::result::Result<T, Error>;