Skip to main content

rars_codec/
lib.rs

1#![cfg_attr(feature = "fast", feature(portable_simd))]
2
3mod fast;
4mod filters;
5mod huffman;
6mod ppmd;
7pub mod rar13;
8pub mod rar20;
9pub mod rar29;
10pub mod rar50;
11pub mod rarvm;
12
13pub type Result<T> = std::result::Result<T, Error>;
14
15#[derive(Debug, Clone, PartialEq, Eq)]
16#[non_exhaustive]
17pub enum Error {
18    InvalidData(&'static str),
19    NeedMoreInput,
20}
21
22impl std::fmt::Display for Error {
23    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
24        match self {
25            Self::InvalidData(msg) => write!(f, "{msg}"),
26            Self::NeedMoreInput => write!(f, "codec input is truncated"),
27        }
28    }
29}
30
31impl std::error::Error for Error {}