Trait scratchpad::ByteData[][src]

pub unsafe trait ByteData: Sized { }

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).

Implementations on Foreign Types

impl ByteData for u8[src]

impl ByteData for u16[src]

impl ByteData for u32[src]

impl ByteData for u64[src]

impl ByteData for u128[src]

impl ByteData for usize[src]

impl ByteData for i8[src]

impl ByteData for i16[src]

impl ByteData for i32[src]

impl ByteData for i64[src]

impl ByteData for i128[src]

impl ByteData for isize[src]

impl<T: ByteData> ByteData for MaybeUninit<T>[src]

Loading content...

Implementors

Loading content...