[−][src]Struct ndarray_npy::NpzWriter
Writer for .npz
files.
Example
use ndarray::{array, Array1, Array2}; use ndarray_npy::NpzWriter; use std::fs::File; let mut npz = NpzWriter::new(File::create("arrays.npz")?); let a: Array2<i32> = array![[1, 2, 3], [4, 5, 6]]; let b: Array1<i32> = array![7, 8, 9]; npz.add_array("a", &a)?; npz.add_array("b", &b)?;
Methods
impl<W: Write + Seek> NpzWriter<W>
[src]
pub fn new(writer: W) -> NpzWriter<W>
[src]
Create a new .npz
file without compression. See numpy.savez
.
pub fn new_compressed(writer: W) -> NpzWriter<W>
[src]
Creates a new .npz
file with compression. See numpy.savez_compressed
.
pub fn add_array<N, S, D>(
&mut self,
name: N,
array: &ArrayBase<S, D>
) -> Result<(), WriteNpzError> where
N: Into<String>,
S::Elem: WritableElement,
S: Data,
D: Dimension,
[src]
&mut self,
name: N,
array: &ArrayBase<S, D>
) -> Result<(), WriteNpzError> where
N: Into<String>,
S::Elem: WritableElement,
S: Data,
D: Dimension,
Adds an array with the specified name
to the .npz
file.
Auto Trait Implementations
impl<W> Send for NpzWriter<W> where
W: Send,
W: Send,
impl<W> Sync for NpzWriter<W> where
W: Sync,
W: Sync,
impl<W> Unpin for NpzWriter<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for NpzWriter<W> where
W: UnwindSafe,
W: UnwindSafe,
impl<W> RefUnwindSafe for NpzWriter<W> where
W: RefUnwindSafe,
W: 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,