Module casper_types::bytesrepr[][src]

Contains serialization and deserialization code for types used throughout the system.

Structs

Bytes

A newtype wrapper for bytes that has efficient serialization routines.

Enums

Error

Serialization and deserialization errors.

Constants

BOOL_SERIALIZED_LENGTH

The number of bytes in a serialized bool.

I32_SERIALIZED_LENGTH

The number of bytes in a serialized i32.

I64_SERIALIZED_LENGTH

The number of bytes in a serialized i64.

OPTION_NONE_TAG

The tag representing a None value.

OPTION_SOME_TAG

The tag representing a Some value.

RESULT_ERR_TAG

The tag representing an Err value.

RESULT_OK_TAG

The tag representing an Ok value.

U8_SERIALIZED_LENGTH

The number of bytes in a serialized u8.

U16_SERIALIZED_LENGTH

The number of bytes in a serialized u16.

U32_SERIALIZED_LENGTH

The number of bytes in a serialized u32.

U64_SERIALIZED_LENGTH

The number of bytes in a serialized u64.

U128_SERIALIZED_LENGTH

The number of bytes in a serialized U128.

U256_SERIALIZED_LENGTH

The number of bytes in a serialized U256.

U512_SERIALIZED_LENGTH

The number of bytes in a serialized U512.

UNIT_SERIALIZED_LENGTH

The number of bytes in a serialized ().

Traits

FromBytes

A type which can be deserialized from a Vec<u8>.

ToBytes

A type which can be serialized to a Vec<u8>.

Functions

allocate_buffer

Returns a Vec<u8> initialized with sufficient capacity to hold to_be_serialized after serialization, or an error if the capacity would exceed u32::max_value().

deserialize

Deserializes bytes into an instance of T.

serialize

Serializes t into a Vec<u8>.

unchecked_allocate_buffer

Returns a Vec<u8> initialized with sufficient capacity to hold to_be_serialized after serialization.