diff --git a/src/lib.rs b/src/lib.rs index 0fee99cc..7f3e7a01 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,3 +42,14 @@ mod spec; mod types; pub mod write; mod zipcrypto; + +/// Unstable APIs +/// +/// All APIs accessible by importing this module are unstable; They may be changed in patch releases. +/// You MUST you an exact version specifier in `Cargo.toml`, to indicate the version of this API you're using: +/// +/// ```toml +/// [dependencies] +/// zip = "=0.6.4" +/// ``` +pub mod unstable; diff --git a/src/read.rs b/src/read.rs index 6f7b7262..ccd43baf 100644 --- a/src/read.rs +++ b/src/read.rs @@ -30,7 +30,7 @@ use bzip2::read::BzDecoder; use zstd::stream::read::Decoder as ZstdDecoder; /// Provides high level API for reading from a stream. -pub mod stream; +pub(crate) mod stream; // Put the struct declaration in a private module to convince rustdoc to display ZipArchive nicely pub(crate) mod zip_archive { @@ -1014,8 +1014,6 @@ impl<'a> Drop for ZipFile<'a> { } } -/// **It is recommended to use [`stream`] for its highlevel API instead.** -/// /// Read ZipFile structures from a non-seekable reader. /// /// This is an alternative method to read a zip file. If possible, use the ZipArchive functions diff --git a/src/read/stream.rs b/src/read/stream.rs index 9db06b91..2ed97a6d 100644 --- a/src/read/stream.rs +++ b/src/read/stream.rs @@ -58,8 +58,8 @@ impl ZipStreamReader { /// Extraction is not atomic; If an error is encountered, some of the files /// may be left on disk. pub fn extract>(self, directory: P) -> ZipResult<()> { - struct Extracter<'a>(&'a Path); - impl ZipStreamVisitor for Extracter<'_> { + struct Extractor<'a>(&'a Path); + impl ZipStreamVisitor for Extractor<'_> { fn visit_file(&mut self, file: &mut ZipFile<'_>) -> ZipResult<()> { let filepath = file .enclosed_name() @@ -103,7 +103,7 @@ impl ZipStreamReader { } } - self.visit(&mut Extracter(directory.as_ref())) + self.visit(&mut Extractor(directory.as_ref())) } } diff --git a/src/types.rs b/src/types.rs index 9fe114cf..c333d8fa 100644 --- a/src/types.rs +++ b/src/types.rs @@ -380,7 +380,7 @@ impl ZipFileData { }) } - pub fn enclosed_name(&self) -> Option<&path::Path> { + pub(crate) fn enclosed_name(&self) -> Option<&path::Path> { if self.file_name.contains('\0') { return None; } @@ -398,7 +398,7 @@ impl ZipFileData { } /// Get unix mode for the file - pub fn unix_mode(&self) -> Option { + pub(crate) fn unix_mode(&self) -> Option { if self.external_attributes == 0 { return None; } diff --git a/src/unstable.rs b/src/unstable.rs new file mode 100644 index 00000000..2cbfa5bb --- /dev/null +++ b/src/unstable.rs @@ -0,0 +1,4 @@ +/// Provides high level API for reading from a stream. +pub mod stream { + pub use crate::read::stream::*; +}