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>

source

pub fn status(&self) -> ChecksumStatus

CRC-32 checksum status.

source

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.

source

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.

source

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.

source

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.

Trait Implementations§

source§

impl<'a> Debug for NpyViewMut<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> Drop for NpyViewMut<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for NpyViewMut<'a>

§

impl<'a> Send for NpyViewMut<'a>

§

impl<'a> Sync for NpyViewMut<'a>

§

impl<'a> Unpin for NpyViewMut<'a>

§

impl<'a> !UnwindSafe for NpyViewMut<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.