Trait npy::Serializable [] [src]

pub trait Serializable: Sized {
    fn dtype() -> DType;
    fn read(c: &mut Cursor<&[u8]>) -> Result<Self>;
    fn write<W: Write>(&self, writer: &mut W) -> Result<()>;
}

This trait contains information on how to serialize and deserialize a type.

It must be implemented for every member of a struct that we use as a serialization target, typically by using #[derive(NpyData)]. An example illustrating Serializable implementation for a vector is in this example.

Required Methods

Convert a type to a structure representing a Numpy type

Deserialize a single data field, advancing the cursor in the process.

Serialize a single data field into a writer.

Implementors