1use std::{
2 error,
3 fmt::{self, Display, Formatter},
4};
5
6use crate::MAGIC_HEADER_BYTES;
7
8#[derive(Debug)]
9pub enum Error {
10 InvalidMagicHeaderString(String),
11 InvalidPageSize(String),
12}
13
14impl Display for Error {
15 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
16 match self {
17 Self::InvalidMagicHeaderString(v) => write!(
18 f,
19 "expected '{}', found {:?}",
20 std::str::from_utf8(&MAGIC_HEADER_BYTES).unwrap(),
21 v,
22 ),
23 Self::InvalidPageSize(msg) => write!(f, ""),
24 }
25 }
26}
27
28impl error::Error for Error {}