1mod byte_reader;
2mod byte_writer;
3mod decoder_7;
4mod decoder_7a;
5mod decoder_8;
6mod encoder_7;
7mod encoder_8;
8mod memory;
9
10use ppmd_sys::*;
11
12pub use decoder_7::Ppmd7Decoder;
13pub use decoder_7a::Ppmd7aDecoder;
14pub use decoder_8::Ppmd8Decoder;
15pub use encoder_7::Ppmd7Encoder;
16pub use encoder_8::Ppmd8Encoder;
17
18pub use ppmd_sys::{
19 PPMD7_MAX_MEM_SIZE, PPMD7_MAX_ORDER, PPMD7_MIN_MEM_SIZE, PPMD7_MIN_ORDER, PPMD8_MAX_ORDER,
20 PPMD8_MIN_ORDER,
21};
22
23pub type Result<T> = core::result::Result<T, Error>;
24
25#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
27pub enum RestoreMethod {
28 Restart = PPMD8_RESTORE_METHOD_RESTART as _,
29 CutOff = PPMD8_RESTORE_METHOD_CUT_OFF as _,
30}
31
32pub enum Error {
34 InvalidParameter,
35 InternalError(&'static str),
36}
37
38impl std::fmt::Debug for Error {
39 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40 match self {
41 Error::InvalidParameter => write!(f, "Wrong PPMd parameter"),
42 Error::InternalError(err) => write!(f, "Internal error: {err}"),
43 }
44 }
45}
46
47impl std::fmt::Display for Error {
48 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
49 std::fmt::Debug::fmt(self, f)
50 }
51}
52
53impl std::error::Error for Error {}