Trait npy::NpyRecord [] [src]

pub trait NpyRecord: Sized {
    fn get_dtype() -> Vec<(&'static str, DType)>;
fn n_bytes() -> usize;
fn read(_: &[u8]) -> Self;
fn write<W: Write>(&self, writer: &mut W) -> Result<()>; }

A trait representing a (de-)serializable data-structure.

If one wants to serialize a Vec<Foo>, the Foo must implement NpyRecord.

This trait is often automatically implemented by a #[derive(NpyRecord)]. This can be done for a struct where all fields implement Serializable.

Required Methods

Get a vector of pairs (field_name, DType) representing the struct type.

Get the number of bytes of this record in the serialized representation

Deserialize binary data to a single instance of Self

Write Self in a binary form to a writer.

Implementors