This commit is contained in:
Andrew Phillips
2026-02-19 13:57:39 -04:00
parent a72395fe83
commit fdeb5f7951
82 changed files with 2756 additions and 2018 deletions

View File

@@ -3,7 +3,7 @@ use std::io;
use std::io::{Read, Write};
use std::path::PathBuf;
use strum::IntoEnumIterator;
use strum::{Display, EnumString, EnumIter};
use strum::{Display, EnumIter, EnumString};
use log::*;
@@ -203,7 +203,9 @@ lazy_static! {
#[cfg(feature = "gzip")]
{
em[CompressionType::GZip] = Box::new(crate::compression_engine::gzip::CompressionEngineGZip::new()) as Box<dyn CompressionEngine>;
em[CompressionType::GZip] =
Box::new(crate::compression_engine::gzip::CompressionEngineGZip::new())
as Box<dyn CompressionEngine>;
}
em
@@ -219,6 +221,9 @@ pub fn get_compression_engine(ct: CompressionType) -> Result<Box<dyn Compression
if engine.is_supported() {
Ok(engine.clone())
} else {
Err(anyhow!("Compression engine for {} is not supported", ct.to_string()))
Err(anyhow!(
"Compression engine for {} is not supported",
ct.to_string()
))
}
}

View File

@@ -68,7 +68,8 @@ impl CompressionEngineProgram {
let supported = program_path.is_ok();
CompressionEngineProgram {
program: program_path.map_or_else(|_| program.to_string(), |p| p.to_string_lossy().to_string()),
program: program_path
.map_or_else(|_| program.to_string(), |p| p.to_string_lossy().to_string()),
compress: compress.iter().map(|s| s.to_string()).collect(),
decompress: decompress.iter().map(|s| s.to_string()).collect(),
supported,
@@ -117,9 +118,10 @@ impl CompressionEngine for CompressionEngineProgram {
args
))?;
let stdout = process.stdout.take().ok_or_else(|| {
anyhow!("Failed to capture stdout from child process")
})?;
let stdout = process
.stdout
.take()
.ok_or_else(|| anyhow!("Failed to capture stdout from child process"))?;
Ok(Box::new(ProgramReader {
process,
@@ -151,9 +153,10 @@ impl CompressionEngine for CompressionEngineProgram {
args
))?;
let stdin = process.stdin.take().ok_or_else(|| {
anyhow!("Failed to capture stdin from child process")
})?;
let stdin = process
.stdin
.take()
.ok_or_else(|| anyhow!("Failed to capture stdin from child process"))?;
Ok(Box::new(ProgramWriter {
process,