Fix some enum issues

This commit is contained in:
Mathijs van de Nes 2014-12-02 16:55:40 +01:00
parent 271ebab7a8
commit 54503e78f2
4 changed files with 6 additions and 5 deletions

View file

@ -1,7 +1,7 @@
[package] [package]
name = "zip" name = "zip"
version = "0.0.3" version = "0.0.4"
authors = ["Mathijs van de Nes <git@mathijs.vd-nes.nl>"] authors = ["Mathijs van de Nes <git@mathijs.vd-nes.nl>"]
license = "MIT" license = "MIT"
repository = "https://github.com/mvdnes/zip-rs.git" repository = "https://github.com/mvdnes/zip-rs.git"

View file

@ -24,12 +24,12 @@ fn doit(filename: &str) -> zip::result::ZipResult<()>
let mut zip = zip::ZipWriter::new(file); 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.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.write(LOREM_IPSUM));
try!(zip.finish()); try!(zip.finish());

View file

@ -11,6 +11,7 @@ extern crate bzip2;
pub use reader::ZipReader; pub use reader::ZipReader;
pub use writer::ZipWriter; pub use writer::ZipWriter;
pub use compression::CompressionMethod;
pub use types::ZipFile; pub use types::ZipFile;
mod util; mod util;

View file

@ -230,7 +230,7 @@ impl<W: Writer+Seek> GenericZipWriter<W>
*self = match compression *self = match compression
{ {
CompressionMethod::Stored => GenericZipWriter::Storer(bare), 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)), CompressionMethod::Bzip2 => GenericZipWriter::Bzip2(BzCompressor::new(bare, bzip2::CompressionLevel::Default)),
_ => return Err(ZipError::UnsupportedZipFile("Unsupported compression")), _ => return Err(ZipError::UnsupportedZipFile("Unsupported compression")),
}; };