pub unsafe trait Bytes: Sized + Copy {
    fn uninitialized() -> Self { ... }
fn size() -> usize { ... }
fn as_u8_ptr(&self) -> *const u8 { ... }
fn as_mut_u8_ptr(&mut self) -> *mut u8 { ... } }
Expand description

A marker trait for types whose size is known at compile time and can be treated as raw buckets of bytes. Any type that implements Bytes must not exhibit undefined behavior when its underlying bits are set to any arbitrary bit pattern.

Safety

This function constructs a value with a fixed but garbage bit pattern. If it is not legal to represent your type as any potential series of bits, then your type may not implement this trait.

Provided methods

Returns an uninitialized value.

Note that this is not the same as mem::uninitialized. Values returned by this function are guaranteed to be set to a well-defined bit pattern, though this function makes no guarantees to what specific bit pattern will be used. The bit pattern has been chosen to maximize the likelihood of catching bugs due to uninitialized data.

Returns the size in bytes of Self.

Returns a *const u8 pointer to the beginning of the data.

Returns a *mut u8 pointer to the beginning of the data.

Implementations on Foreign Types

Implementors