fix: Remove stray doc comment lines that do not document anything
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -155,86 +155,4 @@ pub trait CompressionEngine {
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<()>` - Success if the content is output, or an error.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Propagates errors from copying to stdout.
|
||||
fn cat(&self, file_path: PathBuf) -> Result<()> {
|
||||
let mut stdout = io::stdout().lock();
|
||||
self.copy(file_path, &mut stdout)
|
||||
}
|
||||
|
||||
/// Calculates the decompressed size of a file.
|
||||
///
|
||||
/// Reads the entire decompressed content to determine its size in bytes.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `file_path` - Path to the compressed file.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<usize>` - The decompressed size in bytes, or an error.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an error if the file cannot be opened or read.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let engine = /* some engine */;
|
||||
/// let size = engine.size("file.gz".into()).unwrap();
|
||||
/// println!("Decompressed size: {} bytes", size);
|
||||
/// ```
|
||||
fn size(&self, file_path: PathBuf) -> Result<usize> {
|
||||
let mut reader = self.open(file_path)?;
|
||||
let mut buffer = [0; libc::BUFSIZ as usize];
|
||||
let mut size: usize = 0;
|
||||
|
||||
loop {
|
||||
let n = reader.read(&mut buffer[..libc::BUFSIZ as usize])?;
|
||||
if n == 0 {
|
||||
debug!("COMPRESSION: EOF");
|
||||
break;
|
||||
}
|
||||
|
||||
size += n;
|
||||
}
|
||||
|
||||
Ok(size)
|
||||
}
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
/// Mapping of compression types to their external program implementations
|
||||
pub static ref COMPRESSION_PROGRAMS: EnumMap<CompressionType, Option<CompressionEngineProgram>> = enum_map! {
|
||||
CompressionType::LZ4 => {
|
||||
let program = CompressionEngineProgram::new("lz4", vec!["-c"], vec!["-d", "-c"]);
|
||||
if program.supported { Some(program) } else { None }
|
||||
},
|
||||
CompressionType::GZip => {
|
||||
let program = CompressionEngineProgram::new("gzip", vec!["-c"], vec!["-d", "-c"]);
|
||||
if program.supported { Some(program) } else { None }
|
||||
},
|
||||
CompressionType::BZip2 => {
|
||||
let program = CompressionEngineProgram::new("bzip2", vec!["-qcf"], vec!["-dcf"]);
|
||||
if program.supported { Some(program) } else { None }
|
||||
},
|
||||
CompressionType::XZ => {
|
||||
let program = CompressionEngineProgram::new("xz", vec!["-qcf"], vec!["-dcf"]);
|
||||
if program.supported { Some(program) } else { None }
|
||||
},
|
||||
CompressionType::ZStd => {
|
||||
let program = CompressionEngineProgram::new("zstd", vec!["-qcf"], vec!["-dcf"]);
|
||||
if program.supported { Some(program) } else { None }
|
||||
},
|
||||
CompressionType::None => None
|
||||
};
|
||||
}
|
||||
|
||||
/// Gets a compression engine for the specified compression type.
|
||||
///
|
||||
/// Dynamically selects and instantiates the appropriate compression engine
|
||||
/// based on feature flags
|
||||
/// * `Result<()>` - Success if
|
||||
Reference in New Issue
Block a user