Add contains_file_named
This commit is contained in:
parent
e4d0a0228a
commit
16b66841b3
5 changed files with 20 additions and 7 deletions
|
@ -267,4 +267,11 @@
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Eliminated a custom `AtomicU64` type by replacing it with `OnceLock` in the only place it's used.
|
- Eliminated a custom `AtomicU64` type by replacing it with `OnceLock` in the only place it's used.
|
||||||
- `FileOptions` now has the subtype `SimpleFileOptions` which implements `Copy` but has no extra data.
|
- `FileOptions` now has the subtype `SimpleFileOptions` which implements `Copy` but has no extra data.
|
||||||
|
|
||||||
|
## [1.1.1]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- `contains_file_named`: check whether a file entry exists in a zip file, without initializing the
|
||||||
|
metadata or needing to mutably borrow the `ZipArchive`.
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "1.1.0"
|
version = "1.1.1"
|
||||||
authors = [
|
authors = [
|
||||||
"Mathijs van de Nes <git@mathijs.vd-nes.nl>",
|
"Mathijs van de Nes <git@mathijs.vd-nes.nl>",
|
||||||
"Marli Frost <marli@frost.red>",
|
"Marli Frost <marli@frost.red>",
|
||||||
|
|
|
@ -4,7 +4,7 @@ zip
|
||||||
[](https://github.com/Pr0methean/zip-next/actions?query=branch%3Amaster+workflow%3ACI)
|
[](https://github.com/Pr0methean/zip-next/actions?query=branch%3Amaster+workflow%3ACI)
|
||||||
[](https://crates.io/crates/zip)
|
[](https://crates.io/crates/zip)
|
||||||
|
|
||||||
[Documentation](https://docs.rs/zip/1.1.0/zip/)
|
[Documentation](https://docs.rs/zip/latest/zip/)
|
||||||
|
|
||||||
Info
|
Info
|
||||||
----
|
----
|
||||||
|
@ -33,14 +33,14 @@ With all default features:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
zip = "1.1.0"
|
zip = "1.1.1"
|
||||||
```
|
```
|
||||||
|
|
||||||
Without the default features:
|
Without the default features:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
zip = { version = "1.1.0", default-features = false }
|
zip = { version = "1.1.1", default-features = false }
|
||||||
```
|
```
|
||||||
|
|
||||||
The features available are:
|
The features available are:
|
||||||
|
@ -53,7 +53,8 @@ The features available are:
|
||||||
This is the fastest `deflate` implementation available.
|
This is the fastest `deflate` implementation available.
|
||||||
* `deflate-zopfli`: Enables deflating files with the `zopfli` library (used when compression quality is 10..=264). This
|
* `deflate-zopfli`: Enables deflating files with the `zopfli` library (used when compression quality is 10..=264). This
|
||||||
is the most effective `deflate` implementation available.
|
is the most effective `deflate` implementation available.
|
||||||
* `deflate64`: Enables the deflate64 compression algorithm. Decompression is only supported.
|
* `deflate64`: Enables the deflate64 compression algorithm. Only decompression is supported.
|
||||||
|
* `lzma`: Enables the LZMA compression algorithm. Only decompression is supported.
|
||||||
* `bzip2`: Enables the BZip2 compression algorithm.
|
* `bzip2`: Enables the BZip2 compression algorithm.
|
||||||
* `time`: Enables features using the [time](https://github.com/rust-lang-deprecated/time) crate.
|
* `time`: Enables features using the [time](https://github.com/rust-lang-deprecated/time) crate.
|
||||||
* `chrono`: Enables converting last-modified `zip::DateTime` to and from `chrono::NaiveDateTime`.
|
* `chrono`: Enables converting last-modified `zip::DateTime` to and from `chrono::NaiveDateTime`.
|
||||||
|
|
|
@ -53,6 +53,6 @@ mod zipcrypto;
|
||||||
///
|
///
|
||||||
/// ```toml
|
/// ```toml
|
||||||
/// [dependencies]
|
/// [dependencies]
|
||||||
/// zip = "=1.1.0"
|
/// zip = "=1.1.1"
|
||||||
/// ```
|
/// ```
|
||||||
pub mod unstable;
|
pub mod unstable;
|
||||||
|
|
|
@ -650,6 +650,11 @@ impl<R: Read + Seek> ZipArchive<R> {
|
||||||
pub fn by_name(&mut self, name: &str) -> ZipResult<ZipFile> {
|
pub fn by_name(&mut self, name: &str) -> ZipResult<ZipFile> {
|
||||||
self.by_name_with_optional_password(name, None)
|
self.by_name_with_optional_password(name, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check for a file entry, but do not decrypt it or initialize metadata.
|
||||||
|
pub fn contains_file_named(&self, name: &str) -> bool {
|
||||||
|
self.shared.names_map.contains_key(name)
|
||||||
|
}
|
||||||
|
|
||||||
fn by_name_with_optional_password<'a>(
|
fn by_name_with_optional_password<'a>(
|
||||||
&'a mut self,
|
&'a mut self,
|
||||||
|
|
Loading…
Add table
Reference in a new issue