Trait npyz::WriterBuilder [−][src]
pub trait WriterBuilder<T: Serialize + ?Sized>: Sized { fn order(self, order: Order) -> Self; fn default_dtype(self) -> WithDType<Self>
where
T: AutoSerialize, { ... } fn dtype(self, dtype: DType) -> WithDType<Self> { ... } fn shape(self, shape: &[u64]) -> WithShape<Self> { ... } fn writer<W>(self, writer: W) -> WithWriter<W, Self>
where
Self: MissingWriter, { ... } fn begin_nd(self) -> Result<NpyWriter<T, <Self as HasWriter>::Writer>>
where
Self: HasDType + HasWriter + HasShape,
<Self as HasWriter>::Writer: Write, { ... } fn begin_1d(self) -> Result<NpyWriter<T, <Self as HasWriter>::Writer>>
where
Self: HasDType + HasWriter,
<Self as HasWriter>::Writer: Write + Seek, { ... } }
Expand description
Trait that provides methods on WriteOptions
.
To obtain an initial instance of this trait, call WriteOptions::new
.
The majority of methods return a type that also implements WriterBuilder
; they are meant
to be chained together to construct a full config.
Required methods
Provided methods
fn default_dtype(self) -> WithDType<Self> where
T: AutoSerialize,
fn default_dtype(self) -> WithDType<Self> where
T: AutoSerialize,
Calls Self::dtype
with the default dtype for the type to be serialized.
Calling this method or Self::dtype
is required.
Use the specified dtype.
Calling dtype
(or Self::default_dtype
) is required.
Set the shape for an n-d array.
This is required for any array of dimension != 1
.
fn writer<W>(self, writer: W) -> WithWriter<W, Self> where
Self: MissingWriter,
fn writer<W>(self, writer: W) -> WithWriter<W, Self> where
Self: MissingWriter,
Begin writing an array of the previously supplied shape
.
Begin writing a 1d array, of length to be inferred from the number of elements written.
Notice that, in contrast to Self::begin_nd
, this method requires Seek
. If you have
a Vec<u8>
, you can wrap it in an io::Cursor
to satisfy this requirement.
Note: At present, any shape
you did happen to provide will be ignored and not
validated against the number of elements written. This may change in the future.