1use std::{fmt::Display, string::FromUtf8Error};
2
3#[derive(Debug)]
4pub enum Error {
5 Io(std::io::Error),
6 MalformedIndex,
8 MissingIndex,
10 OutOfBounds,
12 UTF8Error,
13 NotFound,
14}
15
16impl From<FromUtf8Error> for Error {
17 fn from(_: FromUtf8Error) -> Self {
18 Self::UTF8Error
19 }
20}
21
22impl From<std::io::Error> for Error {
23 fn from(e: std::io::Error) -> Self {
24 Self::Io(e)
25 }
26}
27
28impl std::error::Error for Error {}
29
30impl Display for Error {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 write!(f, "{:?}", self)
33 }
34}