From 54503e78f228164183abdffe0776d7e87f211d93 Mon Sep 17 00:00:00 2001 From: Mathijs van de Nes Date: Tue, 2 Dec 2014 16:55:40 +0100 Subject: [PATCH] Fix some enum issues --- Cargo.toml | 2 +- src/bin/write_sample.rs | 6 +++--- src/lib.rs | 1 + src/writer.rs | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 66f882bc..84cc500b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zip" -version = "0.0.3" +version = "0.0.4" authors = ["Mathijs van de Nes "] license = "MIT" repository = "https://github.com/mvdnes/zip-rs.git" diff --git a/src/bin/write_sample.rs b/src/bin/write_sample.rs index a87dc4e9..e108692d 100644 --- a/src/bin/write_sample.rs +++ b/src/bin/write_sample.rs @@ -24,12 +24,12 @@ fn doit(filename: &str) -> zip::result::ZipResult<()> let mut zip = zip::ZipWriter::new(file); - try!(zip.start_file("test/", zip::compression::Stored)); + try!(zip.start_file("test/", zip::CompressionMethod::Stored)); - try!(zip.start_file("test/☃.txt", zip::compression::Stored)); + try!(zip.start_file("test/☃.txt", zip::CompressionMethod::Stored)); try!(zip.write(b"Hello, World!\n")); - try!(zip.start_file("test/lorem_ipsum.txt", zip::compression::Deflated)); + try!(zip.start_file("test/lorem_ipsum.txt", zip::CompressionMethod::Deflated)); try!(zip.write(LOREM_IPSUM)); try!(zip.finish()); diff --git a/src/lib.rs b/src/lib.rs index c68d27a6..7cecc37a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,7 @@ extern crate bzip2; pub use reader::ZipReader; pub use writer::ZipWriter; +pub use compression::CompressionMethod; pub use types::ZipFile; mod util; diff --git a/src/writer.rs b/src/writer.rs index b87714a8..c092c4d8 100644 --- a/src/writer.rs +++ b/src/writer.rs @@ -230,7 +230,7 @@ impl GenericZipWriter *self = match compression { CompressionMethod::Stored => GenericZipWriter::Storer(bare), - CompressionMethod::Deflated => GenericZipWriter::Deflater(bare.deflate_encode(flate2::Default)), + CompressionMethod::Deflated => GenericZipWriter::Deflater(bare.deflate_encode(flate2::CompressionLevel::Default)), CompressionMethod::Bzip2 => GenericZipWriter::Bzip2(BzCompressor::new(bare, bzip2::CompressionLevel::Default)), _ => return Err(ZipError::UnsupportedZipFile("Unsupported compression")), };