pub struct NpyViewMut<'a> { /* private fields */ }Expand description
Mutable view of memory-mapped .npy files within an .npz file.
Does not automatically verify the CRC-32 checksum but does
update it on Drop::drop if view_mut has been invoked
and the checksum has not manually been updated by invoking update.
Implementations§
Source§impl NpyViewMut<'_>
impl NpyViewMut<'_>
Sourcepub fn status(&self) -> ChecksumStatus
pub fn status(&self) -> ChecksumStatus
CRC-32 checksum status.
Sourcepub fn verify(&mut self) -> Result<u32, ViewNpzError>
pub fn verify(&mut self) -> Result<u32, ViewNpzError>
Verifies and returns CRC-32 checksum by reading the whole array.
Changes checksum status to Outdated
if invalid or to Correct if valid.
§Errors
Fails with ZipError::Io if the checksum is invalid.
Sourcepub fn update(&mut self) -> u32
pub fn update(&mut self) -> u32
Updates and returns CRC-32 checksum by reading the whole array.
Changes checksum status to Correct.
Automatically updated on Drop::drop iff checksum status is
Outdated.
Sourcepub fn view<A, D>(&self) -> Result<ArrayView<'_, A, D>, ViewNpzError>where
A: ViewElement,
D: Dimension,
pub fn view<A, D>(&self) -> Result<ArrayView<'_, A, D>, ViewNpzError>where
A: ViewElement,
D: Dimension,
Returns an immutable view of a memory-mapped .npy file.
Iterates over bool array to ensure 0x00/0x01 values.
§Errors
Viewing an .npy file can fail with ViewNpyError.
Sourcepub fn view_mut<A, D>(&mut self) -> Result<ArrayViewMut<'_, A, D>, ViewNpzError>where
A: ViewMutElement,
D: Dimension,
pub fn view_mut<A, D>(&mut self) -> Result<ArrayViewMut<'_, A, D>, ViewNpzError>where
A: ViewMutElement,
D: Dimension,
Returns a mutable view of a memory-mapped .npy file.
Iterates over bool array to ensure 0x00/0x01 values.
Changes checksum status to Outdated.
§Errors
Viewing an .npy file can fail with ViewNpyError.