Expand description
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
Nonevalue. - OPTION_
SOME_ TAG - The tag representing a
Somevalue. - RESULT_
ERR_ TAG - The tag representing an
Errvalue. - RESULT_
OK_ TAG - The tag representing an
Okvalue. - 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§
- From
Bytes - 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 holdto_be_serializedafter serialization, or an error if the capacity would exceedu32::MAX. - allocate_
buffer_ for_ size - Returns a
Vec<u8>initialized with sufficient capacity to holdexpected_sizebytes, or an error if the capacity would exceedu32::MAX. - deserialize
- Deserializes
bytesinto an instance ofT. - deserialize_
from_ slice - Deserializes a slice of bytes into an instance of
T. - serialize
- Serializes
tinto aVec<u8>. - test_
serialization_ roundtrip testing - Asserts that
tcan be serialized and when deserialized back into an instanceTcompares equal tot. - unchecked_
allocate_ buffer - Returns a
Vec<u8>initialized with sufficient capacity to holdto_be_serializedafter serialization.