fix: use explicit snake_case serialization for CompressionType
Per project convention, enum string representations should use snake_case. Use explicit strum serialize attributes instead of serialize_all to avoid incorrect splitting of acronyms like GZip → g_zip and ZStd → z_std.
This commit is contained in:
@@ -34,11 +34,17 @@ use crate::compression_engine::program::CompressionEngineProgram;
|
||||
#[derive(Debug, Eq, PartialEq, Clone, EnumIter, Display, EnumString, enum_map::Enum)]
|
||||
#[strum(ascii_case_insensitive)]
|
||||
pub enum CompressionType {
|
||||
#[strum(serialize = "lz4")]
|
||||
LZ4,
|
||||
#[strum(serialize = "gzip")]
|
||||
GZip,
|
||||
#[strum(serialize = "bzip2")]
|
||||
BZip2,
|
||||
#[strum(serialize = "xz")]
|
||||
XZ,
|
||||
#[strum(serialize = "zstd")]
|
||||
ZStd,
|
||||
#[strum(serialize = "none")]
|
||||
None,
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_compression_type_display() {
|
||||
assert_eq!(format!("{}", CompressionType::LZ4), "LZ4");
|
||||
assert_eq!(format!("{}", CompressionType::GZip), "GZip");
|
||||
assert_eq!(format!("{}", CompressionType::None), "None");
|
||||
assert_eq!(format!("{}", CompressionType::LZ4), "lz4");
|
||||
assert_eq!(format!("{}", CompressionType::GZip), "gzip");
|
||||
assert_eq!(format!("{}", CompressionType::None), "none");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user