Skip to content

Commit

Permalink
Bump dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
n3vu0r committed Jun 5, 2024
1 parent e1223e3 commit 9c6599d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ndarray-npz"
version = "0.1.0"
rust-version = "1.60"
version = "0.2.0"
rust-version = "1.73.0"
edition = "2021"
authors = ["Rouven Spreckels <[email protected]>"]
description = "Advanced .npz file format support for n-dimensional arrays."
Expand Down Expand Up @@ -37,12 +37,12 @@ rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
ndarray = "0.15.6"
ndarray-npy = { version = "0.8.1", default-features = false }
zip = { version = "0.6.4", default-features = false }
crc32fast = "1.3.2"
zip = { version = "2.1.2", default-features = false }
crc32fast = "1.4.2"

[dev-dependencies]
aligned-vec = "0.5"
memmap2 = "0.5.10"
aligned-vec = "0.6"
memmap2 = "0.9.4"

[features]
default = ["compressed", "num-complex-0_4"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[Documentation]: https://docs.rs/ndarray-npz/badge.svg
[Downloads]: https://img.shields.io/crates/d/ndarray-npz.svg
[Version]: https://img.shields.io/crates/v/ndarray-npz.svg
[Rust]: https://img.shields.io/badge/rust-v1.60-brightgreen.svg
[Rust]: https://img.shields.io/badge/rust-v1.73.0-brightgreen.svg
[License]: https://img.shields.io/badge/License-MIT%20OR%20Apache--2.0-blue.svg

Advanced [`.npz`] file format support for [`ndarray`].
Expand Down Expand Up @@ -57,7 +57,7 @@ Both features are enabled by default.

# License

Copyright © 2021-2023 Rouven Spreckels <[email protected]>
Copyright © 2021-2024 Rouven Spreckels <[email protected]>

This project is licensed under either of

Expand Down
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Version 0.2.0 (2024-06-05)

* Bump dependencies.

# Version 0.1.0 (2023-04-08)

* Initial release.
30 changes: 14 additions & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use std::{
};
use zip::{
result::ZipError,
write::FileOptions,
write::SimpleFileOptions,
{CompressionMethod, ZipArchive, ZipWriter},
};

Expand Down Expand Up @@ -130,8 +130,7 @@ impl From<WriteNpyError> for WriteNpzError {
/// ```
pub struct NpzWriter<W: Write + Seek> {
zip: ZipWriter<W>,
options: FileOptions,
align: u16,
options: SimpleFileOptions,
}

impl<W: Write + Seek> NpzWriter<W> {
Expand All @@ -144,8 +143,9 @@ impl<W: Write + Seek> NpzWriter<W> {
pub fn new(writer: W) -> NpzWriter<W> {
NpzWriter {
zip: ZipWriter::new(writer),
options: FileOptions::default().compression_method(CompressionMethod::Stored),
align: 64,
options: SimpleFileOptions::default()
.with_alignment(64)
.compression_method(CompressionMethod::Stored),
}
}

Expand All @@ -157,8 +157,7 @@ impl<W: Write + Seek> NpzWriter<W> {
pub fn new_compressed(writer: W) -> NpzWriter<W> {
NpzWriter {
zip: ZipWriter::new(writer),
options: FileOptions::default().compression_method(CompressionMethod::Deflated),
align: 1,
options: SimpleFileOptions::default().compression_method(CompressionMethod::Deflated),
}
}

Expand All @@ -181,8 +180,7 @@ impl<W: Write + Seek> NpzWriter<W> {
S: Data,
D: Dimension,
{
self.zip
.start_file_aligned(name, self.options, self.align)?;
self.zip.start_file(name.into(), self.options)?;
array.write_npy(BufWriter::new(&mut self.zip))?;
Ok(())
}
Expand All @@ -200,7 +198,7 @@ impl<W: Write + Seek> NpzWriter<W> {
/// # Errors
///
/// Finishing the zip archive can fail with [`ZipError`].
pub fn finish(mut self) -> Result<W, WriteNpzError> {
pub fn finish(self) -> Result<W, WriteNpzError> {
let mut writer = self.zip.finish()?;
writer.flush().map_err(ZipError::from)?;
Ok(writer)
Expand Down Expand Up @@ -570,11 +568,11 @@ impl<'a> NpzView<'a> {
/// [`ZipError::FileNotFound`] if the `name` is not found.
pub fn by_name(&self, name: &str) -> Result<NpyView<'a>, ViewNpzError> {
self.by_index(self.names.get(name).copied().ok_or_else(|| {
if self.directory_names.get(name).is_some() {
if self.directory_names.contains(name) {
ViewNpzError::Directory
} else if self.compressed_names.get(name).is_some() {
} else if self.compressed_names.contains(name) {
ViewNpzError::CompressedFile
} else if self.encrypted_names.get(name).is_some() {
} else if self.encrypted_names.contains(name) {
ViewNpzError::EncryptedFile
} else {
ZipError::FileNotFound.into()
Expand Down Expand Up @@ -924,11 +922,11 @@ impl<'a> NpzViewMut<'a> {
/// [`ZipError::FileNotFound`] if the `name` is not found.
pub fn by_name(&mut self, name: &str) -> Result<NpyViewMut<'a>, ViewNpzError> {
self.by_index(self.names.get(name).copied().ok_or_else(|| {
if self.directory_names.get(name).is_some() {
if self.directory_names.contains(name) {
ViewNpzError::Directory
} else if self.compressed_names.get(name).is_some() {
} else if self.compressed_names.contains(name) {
ViewNpzError::CompressedFile
} else if self.encrypted_names.get(name).is_some() {
} else if self.encrypted_names.contains(name) {
ViewNpzError::EncryptedFile
} else {
ZipError::FileNotFound.into()
Expand Down

0 comments on commit 9c6599d

Please sign in to comment.