refactor: remove redundant copy method from CompressionEngine implementations
This commit is contained in:
@@ -41,12 +41,6 @@ impl CompressionEngine for CompressionEngineGZip {
|
|||||||
Ok(Box::new(AutoFinishGzEncoder::new(gzip_write)))
|
Ok(Box::new(AutoFinishGzEncoder::new(gzip_write)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy(&self, file_path: PathBuf, writer: &mut dyn Write) -> Result<()> {
|
|
||||||
let mut reader = self.open(file_path)?;
|
|
||||||
io::copy(&mut reader, writer)?;
|
|
||||||
writer.flush()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct AutoFinishGzEncoder<W: Write> {
|
pub struct AutoFinishGzEncoder<W: Write> {
|
||||||
|
|||||||
@@ -40,11 +40,5 @@ impl CompressionEngine for CompressionEngineLZ4 {
|
|||||||
Ok(Box::new(lz4_write))
|
Ok(Box::new(lz4_write))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy(&self, file_path: PathBuf, writer: &mut dyn Write) -> Result<()> {
|
|
||||||
let mut reader = self.open(file_path)?;
|
|
||||||
io::copy(&mut reader, writer)?;
|
|
||||||
writer.flush()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,4 @@ impl CompressionEngine for CompressionEngineNone {
|
|||||||
Ok(Box::new(File::create(file_path)?))
|
Ok(Box::new(File::create(file_path)?))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy(&self, file_path: PathBuf, writer: &mut dyn Write) -> Result<()> {
|
|
||||||
let mut reader = self.open(file_path)?;
|
|
||||||
io::copy(&mut reader, writer)?;
|
|
||||||
writer.flush()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,12 +79,6 @@ impl CompressionEngine for CompressionEngineProgram {
|
|||||||
Ok(Box::new(process.stdin.unwrap()))
|
Ok(Box::new(process.stdin.unwrap()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn copy(&self, file_path: PathBuf, writer: &mut dyn Write) -> Result<()> {
|
|
||||||
let mut reader = self.open(file_path)?;
|
|
||||||
io::copy(&mut reader, writer)?;
|
|
||||||
writer.flush()?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_program_path(program: &str) -> Result<String> {
|
fn get_program_path(program: &str) -> Result<String> {
|
||||||
|
|||||||
Reference in New Issue
Block a user