Struct ndarray_npz::NpzReader
source · pub struct NpzReader<R: Read + Seek> { /* private fields */ }
Expand description
Reader for .npz
files.
§Example
use ndarray_npz::{
ndarray::{Array1, Array2},
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")?;
Implementations§
source§impl<R: Read + Seek> NpzReader<R>
impl<R: Read + Seek> NpzReader<R>
sourcepub fn new(reader: R) -> Result<NpzReader<R>, ReadNpzError>
pub fn new(reader: R) -> Result<NpzReader<R>, ReadNpzError>
sourcepub fn by_name<S, D>(
&mut self,
name: &str,
) -> Result<ArrayBase<S, D>, ReadNpzError>
pub fn by_name<S, D>( &mut self, name: &str, ) -> Result<ArrayBase<S, D>, ReadNpzError>
Reads an array by name.
§Errors
Reading an array from an archive can fail with ReadNpyError
or ZipError
.
sourcepub fn by_index<S, D>(
&mut self,
index: usize,
) -> Result<ArrayBase<S, D>, ReadNpzError>
pub fn by_index<S, D>( &mut self, index: usize, ) -> Result<ArrayBase<S, D>, ReadNpzError>
Reads an array by index in the .npz
file.
§Errors
Reading an array from an archive can fail with ReadNpyError
or ZipError
.
Auto Trait Implementations§
impl<R> Freeze for NpzReader<R>where
R: Freeze,
impl<R> RefUnwindSafe for NpzReader<R>where
R: RefUnwindSafe,
impl<R> Send for NpzReader<R>where
R: Send,
impl<R> Sync for NpzReader<R>where
R: Sync,
impl<R> Unpin for NpzReader<R>where
R: Unpin,
impl<R> UnwindSafe for NpzReader<R>where
R: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more