Module fuel_types::bytes
source · Expand description
Word-aligned bytes serialization functions.
Constants
- Memory size of a
Word
Traits
- Describe the ability to deserialize the type from sets of bytes.
- Auto-trait to create variable sized vectors out of
SizedBytesimplementations. - Define the amount of bytes for a serialization implementation.
Functions
- End of file error representation.
- Add a conversion from arbitrary slices into arrays
- Return the word-padded length of the buffer
- Return the word-padded length of an arbitrary length
- Restore a statically sized array from a buffer, returning the array and the remainder of the buffer.
- Read an array of
Nbytes frombuf. - Attempt to restore a variable size bytes from a buffer.
- Attempt to read a word-aligned number stored in the buffer.
- Read the initial bytes of a buffer to fetch a word.
- Attempt to restore a variable size bytes with the length specified as argument.
- Read the a word-padded u8 from a buffer.
- Read the a word-padded u16 from a buffer.
- Read the a word-padded u32 from a buffer.
- Read the a word-padded usize from a buffer.
- Read the initial bytes of a buffer to fetch a word.
- Store a statically sized array into a buffer, returning the remainder of the buffer.
- Copy
arrayintobufand return the remainder bytes ofbuf - Attempt to store into the provided buffer the length of
bytesas big-endian, and then the bytes itself. Thebyteswill be padded to be word-aligned. - Convert a number to a word, store it in the buffer, and return a tuple containing the number of written bytes and the remainder of the buffer.
- Consume the initial bytes of a buffer to store a word.
- Attempt to store into the provided buffer the provided bytes. They will be padded to be word-aligned.