use serde::{Deserialize, Serialize};
use std::fmt::Display;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum CompressionType {
Lz4,
Zstd,
Xz,
NoComp,
Auto,
}
impl CompressionType {
pub fn description(&self) -> String {
match self {
Self::Auto => "Automatic".to_string(),
Self::Lz4 => "Lz4 (fastest)".to_string(),
Self::Xz => "Xz (slowest but most efficient)".to_string(),
Self::NoComp => "No compression".to_string(),
Self::Zstd => "Zstd (Balanced)".to_string(),
}
}
}
impl From<CompressionType> for String {
fn from(value: CompressionType) -> Self {
value.description()
}
}
impl Display for CompressionType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.description())
}
}