Trait npyz::AutoSerialize
source · pub trait AutoSerialize: Serialize {
// Required method
fn default_dtype() -> DType;
}
Expand description
Subtrait of Serialize
for types which have a reasonable default DType
.
Complete documentation of all types that implement this trait is available on the
type_matchup_docs
module.
This opens up some simpler APIs for serialization. (e.g. crate::to_file
, crate::WriterBuilder::default_dtype
)
This trait is derivable when enabling the "derive"
feature. This makes it easier
to work with structured arrays.
For an example of how to implement this manually, see Vector5
in the
roundtrip test.
Required Methods§
sourcefn default_dtype() -> DType
fn default_dtype() -> DType
A suggested format for serialization.
The builtin implementations for primitive types generally prefer |
endianness if possible,
else the machine endian format.
Object Safety§
Implementations on Foreign Types§
source§impl AutoSerialize for bool
impl AutoSerialize for bool
fn default_dtype() -> DType
source§impl AutoSerialize for f32
impl AutoSerialize for f32
fn default_dtype() -> DType
source§impl AutoSerialize for f64
impl AutoSerialize for f64
fn default_dtype() -> DType
source§impl AutoSerialize for i8
impl AutoSerialize for i8
fn default_dtype() -> DType
source§impl AutoSerialize for i16
impl AutoSerialize for i16
fn default_dtype() -> DType
source§impl AutoSerialize for i32
impl AutoSerialize for i32
fn default_dtype() -> DType
source§impl AutoSerialize for i64
impl AutoSerialize for i64
fn default_dtype() -> DType
source§impl AutoSerialize for u8
impl AutoSerialize for u8
fn default_dtype() -> DType
source§impl AutoSerialize for u16
impl AutoSerialize for u16
fn default_dtype() -> DType
source§impl AutoSerialize for u32
impl AutoSerialize for u32
fn default_dtype() -> DType
source§impl AutoSerialize for u64
impl AutoSerialize for u64
fn default_dtype() -> DType
source§impl AutoSerialize for f16
impl AutoSerialize for f16
fn default_dtype() -> DType
source§impl AutoSerialize for Complex<f32>
impl AutoSerialize for Complex<f32>
This impl is only available with the "complex"
feature.
fn default_dtype() -> DType
source§impl AutoSerialize for Complex<f64>
impl AutoSerialize for Complex<f64>
This impl is only available with the "complex"
feature.
fn default_dtype() -> DType
source§impl<T> AutoSerialize for Cow<'_, T>
impl<T> AutoSerialize for Cow<'_, T>
fn default_dtype() -> DType
source§impl<T> AutoSerialize for &Twhere
T: AutoSerialize + ?Sized,
impl<T> AutoSerialize for &Twhere
T: AutoSerialize + ?Sized,
fn default_dtype() -> DType
source§impl<T> AutoSerialize for &mut Twhere
T: AutoSerialize + ?Sized,
impl<T> AutoSerialize for &mut Twhere
T: AutoSerialize + ?Sized,
fn default_dtype() -> DType
source§impl<T> AutoSerialize for Box<T>where
T: AutoSerialize + ?Sized,
impl<T> AutoSerialize for Box<T>where
T: AutoSerialize + ?Sized,
fn default_dtype() -> DType
source§impl<T> AutoSerialize for Rc<T>where
T: AutoSerialize + ?Sized,
impl<T> AutoSerialize for Rc<T>where
T: AutoSerialize + ?Sized,
fn default_dtype() -> DType
source§impl<T> AutoSerialize for Arc<T>where
T: AutoSerialize + ?Sized,
impl<T> AutoSerialize for Arc<T>where
T: AutoSerialize + ?Sized,
fn default_dtype() -> DType
source§impl<T: AutoSerialize + Default + Copy, const N: usize> AutoSerialize for [T; N]
impl<T: AutoSerialize + Default + Copy, const N: usize> AutoSerialize for [T; N]
fn default_dtype() -> DType
source§impl<const N: usize> AutoSerialize for ArrayString<N>
impl<const N: usize> AutoSerialize for ArrayString<N>
This impl is only available with the arrayvec
feature.
fn default_dtype() -> DType
source§impl<const N: usize> AutoSerialize for ArrayVec<char, N>
impl<const N: usize> AutoSerialize for ArrayVec<char, N>
This impl is only available with the arrayvec
feature.
fn default_dtype() -> DType
source§impl<const N: usize> AutoSerialize for ArrayVec<u32, N>
impl<const N: usize> AutoSerialize for ArrayVec<u32, N>
This impl is only available with the arrayvec
feature.