Skip to main content

rars_codec/
lib.rs

1#![cfg_attr(feature = "fast", feature(portable_simd))]
2
3//! Deprecated as a standalone public dependency: this crate remains an
4//! implementation detail for the current release. New Rust users should depend
5//! on the `rars` crate instead.
6//!
7//! RAR compression codecs, filters, PPMd, and RARVM components used by `rars`.
8
9mod fast;
10mod filters;
11mod huffman;
12mod ppmd;
13pub mod rar13;
14pub mod rar20;
15pub mod rar29;
16pub mod rar50;
17pub mod rarvm;
18
19pub type Result<T> = std::result::Result<T, Error>;
20
21#[derive(Debug, Clone, PartialEq, Eq)]
22#[non_exhaustive]
23pub enum Error {
24    InvalidData(&'static str),
25    NeedMoreInput,
26}
27
28impl std::fmt::Display for Error {
29    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
30        match self {
31            Self::InvalidData(msg) => write!(f, "{msg}"),
32            Self::NeedMoreInput => write!(f, "codec input is truncated"),
33        }
34    }
35}
36
37impl std::error::Error for Error {}