Stylistic update
This commit is contained in:
@@ -4,12 +4,14 @@ use std::io;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use log::*;
|
use log::*;
|
||||||
extern crate enum_map;
|
|
||||||
|
use lz4_flex::frame::{FrameDecoder, FrameEncoder};
|
||||||
|
|
||||||
use crate::compression::CompressionEngine;
|
use crate::compression::CompressionEngine;
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq, Clone, Default)]
|
#[derive(Debug, Eq, PartialEq, Clone, Default)]
|
||||||
pub struct CompressionEngineLZ4 {}
|
pub struct CompressionEngineLZ4 {
|
||||||
|
}
|
||||||
|
|
||||||
impl CompressionEngineLZ4 {
|
impl CompressionEngineLZ4 {
|
||||||
pub fn new() -> CompressionEngineLZ4 {
|
pub fn new() -> CompressionEngineLZ4 {
|
||||||
@@ -27,7 +29,7 @@ impl CompressionEngine for CompressionEngineLZ4 {
|
|||||||
|
|
||||||
let mut stdout = io::stdout().lock();
|
let mut stdout = io::stdout().lock();
|
||||||
let file = File::open(file_path)?;
|
let file = File::open(file_path)?;
|
||||||
let mut lz4_read = lz4_flex::frame::FrameDecoder::new(file);
|
let mut lz4_read = FrameDecoder::new(file);
|
||||||
|
|
||||||
io::copy(&mut lz4_read, &mut stdout)?;
|
io::copy(&mut lz4_read, &mut stdout)?;
|
||||||
stdout.flush()?;
|
stdout.flush()?;
|
||||||
@@ -39,7 +41,7 @@ impl CompressionEngine for CompressionEngineLZ4 {
|
|||||||
debug!("COMPRESSION: Writting to {:?} using {:?}", file_path, *self);
|
debug!("COMPRESSION: Writting to {:?} using {:?}", file_path, *self);
|
||||||
|
|
||||||
let file = File::create(file_path)?;
|
let file = File::create(file_path)?;
|
||||||
let lz4_write = lz4_flex::frame::FrameEncoder::new(file).auto_finish();
|
let lz4_write = FrameEncoder::new(file).auto_finish();
|
||||||
|
|
||||||
Ok(Box::new(lz4_write))
|
Ok(Box::new(lz4_write))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user