Struct npyz::NpyData[][src]

pub struct NpyData<'a, T: Deserialize> { /* fields omitted */ }
👎 Deprecated since 0.5.0:

use NpyReader instead

Expand description

Legacy type for reading npy files.

This type provides the same API for reading from npy-rs 0.4.0, to help with migration. It will later be removed in favor of NpyFile.

The data is internally stored as a byte array, and deserialized only on-demand to minimize unnecessary allocations. The whole contents of the file can be deserialized by the NpyData::to_vec method.

Implementations

Deserialize a NPY file represented as bytes

Returns the total number of elements.

Returns whether there are zero records in this NpyData structure.

Gets a single data-record with the specified flat index.

Returns None if the index is out of bounds.

Panics

Panics if the bytes stored for the element are invalid for the dtype.

Gets a single data-record with the specified index.

Panics

Panics if the bytes stored for the element are invalid for the dtype, or if the index is out of bounds.

Construct a vector with the deserialized contents of the whole file.

The output is a flat vector with the elements in the same order that they are in the file. NpyData is deprecated and does not provide any tools for inspecting the shape and layout of the data, so if you want to correctly read multi-dimensional arrays you should switch to NpyFile.

Trait Implementations

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.