1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#![deny(clippy::all)]
pub mod utils;
pub(crate) mod reader;
pub(crate) mod writer;
pub type Result<T> = std::result::Result<T, Error>;
#[cfg(feature = "fail")]
use thiserror::Error;
#[cfg(feature = "fail")]
#[derive(Debug, Error)]
pub enum Error {
#[error("io error: {0:?}")]
IoError(std::io::Error),
#[error("invalid archive")]
InvalidArchive,
#[error("unsupported file format")]
UnsupportedFileFormat,
#[error("no entry")]
NoEntry,
#[error("compression failed")]
CompressionFailed,
}
#[cfg(not(feature = "fail"))]
#[derive(Debug)]
pub enum Error {
IoError(std::io::Error),
InvalidArchive,
UnsupportedFileFormat,
NoEntry,
CompressionFailed,
}
impl From<std::io::Error> for Error {
fn from(e: std::io::Error) -> Self {
Self::IoError(e)
}
}
pub use reader::{S25Archive, S25Image, S25ImageMetadata};
pub use writer::S25Writer;