Struct ndarray_npz::NpyViewMut
source · 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<'a> NpyViewMut<'a>
impl<'a> NpyViewMut<'a>
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
.