Trait scratchpad::ByteData [−][src]
Trait for types that can be safely used as the backing data type for storage of arbitrary data.
ByteData
is implemented by default for all basic integer types as well
as the CacheAligned
struct provided by this crate.
Safety
This trait is used to help constrain implementations of the Buffer
trait to known types that are considered "safe" to use as the backing
storage type of a buffer. To properly implement this trait, the type
should have the following characteristics:
- Allow arbitrary bytes within instances of the type to be left
uninitialized without any possible side effects (outside of attempts to
explicitly read those bytes). In particular, types should not have
Drop
trait implementations that rely on the data to be in any particular state. - Allow arbitrary bytes within instances of the type to be written to with arbitrary values without affecting other bytes.
- Allow previously written bytes to be read back regardless of whether other bytes have been written to yet (only bytes that have been explicitly written to are expected to be read back).