volaris_tools/
header.rs

1//! This module contains all volaris header-related functions, such as dumping the header, restoring a dumped header, or stripping it entirely.
2
3pub mod dump;
4pub mod restore;
5pub mod strip;
6
7#[derive(Debug)]
8pub enum Error {
9    UnsupportedRestore,
10    InvalidFile,
11    Write,
12    Read,
13    HeaderSizeParse,
14    Rewind,
15}
16
17impl std::fmt::Display for Error {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        use Error::{HeaderSizeParse, InvalidFile, Read, Rewind, UnsupportedRestore, Write};
20        match self {
21            UnsupportedRestore => f.write_str("The provided request is unsupported with this file. It maybe isn't an encrypted file, or it was encrypted in detached mode."),
22            InvalidFile => f.write_str("The file does not contain a valid volaris header."),
23            Write => f.write_str("Unable to write the data."),
24            Read => f.write_str("Unable to read the data."),
25            Rewind => f.write_str("Unable to rewind the stream."),
26            HeaderSizeParse => f.write_str("Unable to parse the size of the header."),
27        }
28    }
29}
30
31impl std::error::Error for Error {}