From bfc370eda316d2aa26de74d88fad7c1f78b5bcbf Mon Sep 17 00:00:00 2001 From: Mathijs van de Nes Date: Wed, 25 Feb 2015 12:13:13 +0100 Subject: [PATCH] Update for new bzip2 --- Cargo.toml | 5 +---- src/writer.rs | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4aa332f1..04829961 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,5 @@ Library to support the reading and writing of zip files. [dependencies] flate2 = "*" +bzip2 = "*" time = "*" - -[dependencies.bzip2] -git = "https://github.com/mvdnes/bzip2-rs" -branch = "new_io" diff --git a/src/writer.rs b/src/writer.rs index 4281b6e6..6a067208 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -15,7 +15,7 @@ use flate2::write::DeflateEncoder; use bzip2; use bzip2::writer::BzCompressor; -enum GenericZipWriter +enum GenericZipWriter { Closed, Storer(W), @@ -46,7 +46,7 @@ enum GenericZipWriter /// /// println!("Result: {:?}", doit()); /// ``` -pub struct ZipWriter +pub struct ZipWriter { inner: GenericZipWriter, files: Vec, @@ -243,7 +243,7 @@ impl GenericZipWriter { CompressionMethod::Stored => GenericZipWriter::Storer(bare), CompressionMethod::Deflated => GenericZipWriter::Deflater(bare.deflate_encode(flate2::Compression::Default)), - CompressionMethod::Bzip2 => GenericZipWriter::Bzip2(BzCompressor::new(bare, bzip2::CompressionLevel::Default)), + CompressionMethod::Bzip2 => GenericZipWriter::Bzip2(BzCompressor::new(bare, bzip2::Compress::Default)), _ => return Err(ZipError::UnsupportedZipFile("Unsupported compression")), };