[−][src]Struct ndarray_npy::NpzReader
Reader for .npz
files.
Example
use ndarray::{Array1, Array2}; use ndarray_npy::NpzReader; use std::fs::File; let mut npz = NpzReader::new(File::open("arrays.npz")?)?; let a: Array2<i32> = npz.by_name("a")?; let b: Array1<i32> = npz.by_name("b")?;
Methods
impl<R: Read + Seek> NpzReader<R>
[src]
pub fn new(reader: R) -> Result<NpzReader<R>, ReadNpzError>
[src]
Creates a new .npz
file reader.
pub fn is_empty(&self) -> bool
[src]
Returns true
iff the .npz
file doesn't contain any arrays.
pub fn len(&self) -> usize
[src]
Returns the number of arrays in the .npz
file.
pub fn names(&mut self) -> Result<Vec<String>, ReadNpzError>
[src]
Returns the names of all of the arrays in the file.
pub fn by_name<S, D>(
&mut self,
name: &str
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
[src]
&mut self,
name: &str
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
Reads an array by name.
pub fn by_index<S, D>(
&mut self,
index: usize
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
[src]
&mut self,
index: usize
) -> Result<ArrayBase<S, D>, ReadNpzError> where
S::Elem: ReadableElement,
S: DataOwned,
D: Dimension,
Reads an array by index in the .npz
file.
Auto Trait Implementations
impl<R> Send for NpzReader<R> where
R: Send,
R: Send,
impl<R> Sync for NpzReader<R> where
R: Sync,
R: Sync,
impl<R> Unpin for NpzReader<R> where
R: Unpin,
R: Unpin,
impl<R> UnwindSafe for NpzReader<R> where
R: UnwindSafe,
R: UnwindSafe,
impl<R> RefUnwindSafe for NpzReader<R> where
R: RefUnwindSafe,
R: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,