Skip to main content

StagingPod

Trait StagingPod 

Source
pub unsafe trait StagingPod: Copy { }
Expand description

Types for which every bit pattern is a valid value.

StagingBuffer hands out &mut [T] / &[T] views over page-locked bytes that were either zero-filled at allocation time or last written by a DMA from the device. Materialising such a view is only sound when no bit pattern those bytes could hold is invalid for T — which rules out types with niches (bool, char, NonZeroU32, enums, references) even though they are Copy.

§Safety

Implementors must guarantee that T has no invalid bit patterns, no padding whose contents could be observed as uninitialised, and no interior pointers/references that would be meaningless after a device round trip. Numeric primitives and #[repr(transparent)] wrappers over them qualify.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl StagingPod for bf16

Available on crate feature half only.
Source§

impl StagingPod for f16

Available on crate feature half only.
Source§

impl StagingPod for f32

Source§

impl StagingPod for f64

Source§

impl StagingPod for i8

Source§

impl StagingPod for i16

Source§

impl StagingPod for i32

Source§

impl StagingPod for i64

Source§

impl StagingPod for i128

Source§

impl StagingPod for isize

Source§

impl StagingPod for u8

Source§

impl StagingPod for u16

Source§

impl StagingPod for u32

Source§

impl StagingPod for u64

Source§

impl StagingPod for u128

Source§

impl StagingPod for usize

Implementors§