1use std::{error, fmt};
2
3#[derive(Debug, Clone, Copy)]
5#[non_exhaustive]
6pub enum Error {
7    EmptyChoose,
9    NotEnoughData,
12    IncorrectFormat,
14}
15
16impl fmt::Display for Error {
17    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18        match self {
19            Error::EmptyChoose => write!(
20                f,
21                "`arbitrary::Unstructured::choose` must be given a non-empty set of choices"
22            ),
23            Error::NotEnoughData => write!(
24                f,
25                "There is not enough underlying raw data to construct an `Arbitrary` instance"
26            ),
27            Error::IncorrectFormat => write!(
28                f,
29                "The raw data is not of the correct format to construct this type"
30            ),
31        }
32    }
33}
34
35impl error::Error for Error {}
36
37pub type Result<T> = std::result::Result<T, Error>;