[][src]Module grin_core::ser

Serialization and deserialization layer specialized for binary encoding. Ensures consistency and safety. Basically a minimal subset or rustc_serialize customized for our need.

To use it simply implement Writeable or Readable and then use the serialize or deserialize functions on them as appropriate.

Structs

BinWriter

Utility wrapper for an underlying byte Writer. Defines higher level methods to write numbers, byte vectors, hashes, etc.

Enums

Error

Possible errors deriving from serializing or deserializing.

SerializationMode

Signal to a serializable object how much of its data should be serialized

Traits

AsFixedBytes

Useful marker trait on types that can be sized byte slices

PMMRIndexHashable

Generic trait to ensure PMMR elements can be hashed with an index

PMMRable

Trait for types that can serialize and report their size

Readable

Trait that every type that can be deserialized from binary must implement. Reads directly to a Reader, a utility type thinly wrapping an underlying Read implementation.

Reader

Implementations defined how different numbers and binary structures are read from an underlying stream or container (depending on implementation).

Writeable

Trait that every type that can be serialized as binary must implement. Writes directly to a Writer, a utility type thinly wrapping an underlying Write implementation.

Writer

Implementations defined how different numbers and binary structures are written to an underlying stream or container (depending on implementation).

Functions

deserialize

Deserializes a Readeable from any std::io::Read implementation.

read_multi

Reads multiple serialized items into a Vec.

ser_vec

Utility function to serialize a writeable directly in memory using a Vec.

serialize

Serializes a Writeable into any std::io::Write implementation.