|
|
|
@ -5,6 +5,14 @@ use std::{
|
|
|
|
|
path::PathBuf,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// Start or end bounds
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub enum Bound
|
|
|
|
|
{
|
|
|
|
|
Start,
|
|
|
|
|
End,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub enum DecodeError
|
|
|
|
|
{
|
|
|
|
@ -15,7 +23,7 @@ pub enum DecodeError
|
|
|
|
|
/// Map contained invalid base64
|
|
|
|
|
Base64,
|
|
|
|
|
/// Couldn't find base64 bounds
|
|
|
|
|
Bounds,
|
|
|
|
|
Bounds(Bound),
|
|
|
|
|
/// Bad size
|
|
|
|
|
Size,
|
|
|
|
|
}
|
|
|
|
@ -38,7 +46,8 @@ impl fmt::Display for DecodeError
|
|
|
|
|
Self::Map(io, path) => write!(f, "mmap (file {:?}) failed: {}", path, io),
|
|
|
|
|
Self::Corrupt => write!(f, "data was corrupt (invalid utf-8)"),
|
|
|
|
|
Self::Base64 => write!(f, "data was corrupt (invalid base64)"),
|
|
|
|
|
Self::Bounds => write!(f, "couldn't find base64 bounds"),
|
|
|
|
|
Self::Bounds(Bound::Start) => write!(f, "couldn't find base64 bounds (start)"),
|
|
|
|
|
Self::Bounds(Bound::End) => write!(f, "couldn't find base64 bounds (end)"),
|
|
|
|
|
Self::Size => write!(f, "bad size"),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|