pub unsafe trait WritableToBytes { }
Expand description

Specifies that a type is safely writable to byte slices.

This means that we don’t read undefined values (which leads to UB) in preparation for writing to the byte slice. It also ensures that no potentially sensitive information is leaked into the byte slices.


A type must not include padding bytes and must be fully initialised to safely implement WritableToBytes (i.e., it doesn’t contain MaybeUninit fields). A composition of writable types in a structure is not necessarily writable because it may result in padding bytes.

Implementations on Foreign Types